Get MAC IP for use in indicator

Created at 03 Dec 2020, 16:48
M.

m.ghobeishavi1986

Joined 14.06.2018

Get MAC IP for use in indicator
03 Dec 2020, 16:48


I input these code:

public string GetMACAddress()
        {
            NetworkInterface[] nics = NetworkInterface.GetAllNetworkInterfaces();
            string sMacAddress = "";
            try
            {
                foreach (NetworkInterface adapter in nics)
                {
                    // only return MAC Address from first card  
                    if (sMacAddress == String.Empty)
                    {
                        IPInterfaceProperties properties = adapter.GetIPProperties();
                        sMacAddress = adapter.GetPhysicalAddress().ToString();
                    }
                }
            } catch
            {
                sMacAddress = "";
            }
            return sMacAddress;
        }

How can I solve these Errors.

Thank you.


cTrader
@m.ghobeishavi1986