using System; using System.Globalization; using System.Net; using System.Net.NetworkInformation; namespace GSF.Net.Snmp { /// /// Class Helper. /// public static class Helper { /// /// Converts to . /// /// The object. /// The object. public static IPAddress ToIPAddress(this IP ip) { return new IPAddress(ip.GetRaw()); } /// /// Converts to . /// /// The object that holds the address. /// The object. /// length is not equal to 6. public static PhysicalAddress ToPhysicalAddress(this OctetString address) { byte[] raw = address.GetRaw(); if (raw.Length != 6) { throw new InvalidCastException(string.Format(CultureInfo.InvariantCulture, "the data length is not equal to 6: {0}", raw.Length)); } return new PhysicalAddress(raw); } } }