Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

can't build - error CS0719 about NetworkInterface

Discussion in 'AR/VR (XR) Discussion' started by Kideokk, Jul 11, 2018.

  1. Kideokk

    Kideokk

    Joined:
    Jan 18, 2018
    Posts:
    31
    hi everyone, i'm trying to uwp build project.
    but i can't build because error code - CS0719 : 'NetworkInterface' : array elements cannot be of static type
    how do i fix this error?
    in my code :
    Code (CSharp):
    1.     NetworkInterface[] nics;
    2.     string MacLicence = "TestMacAddress";
    3.     bool CheckAddress()
    4.     {
    5.         bool check = false;
    6.         string macAddress = null;
    7.         foreach (NetworkInterface adapter in nics)
    8.         {
    9.             PhysicalAddress address = adapter.GetPhysicalAddress();
    10.             byte[] bytes = address.GetAddressBytes();
    11.             for (int i = 0; i < bytes.Length; i++)
    12.             {
    13.                 macAddress = string.Concat(macAddress + (string.Format("{0}", bytes[i].ToString("X2"))));
    14.             }
    15.             if (macAddress == MacLicence)
    16.             {
    17.                 check = true;
    18.                 break;
    19.             }
    20.             macAddress = null;
    21.         }
    22.         return check;
    23.     }