/// <summary>Converts an Internet address to its standard notation.</summary> /// <returns>A string that contains the IP address in either IPv4 dotted-quad or in IPv6 colon-hexadecimal notation.</returns> /// <PermissionSet> /// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" /> /// </PermissionSet> public override string ToString() { if (m_Family == AddressFamily.InterNetwork) { return(ToString(m_Address)); } ushort[] array = m_Numbers.Clone() as ushort[]; for (int i = 0; i < array.Length; i++) { array[i] = (ushort)NetworkToHostOrder((short)array[i]); } IPv6Address pv6Address = new IPv6Address(array); pv6Address.ScopeId = ScopeId; return(pv6Address.ToString()); }
/// <summary> /// Overrides System.Object.ToString to return /// this object rendered in a quad-dotted notation /// </summary> public override string ToString() { if (m_Family == AddressFamily.InterNetwork) { return(ToString(m_Address)); } else { ushort[] numbers = m_Numbers.Clone() as ushort[]; for (int i = 0; i < numbers.Length; i++) { numbers[i] = (ushort)NetworkToHostOrder((short)numbers[i]); } IPv6Address v6 = new IPv6Address(numbers); v6.ScopeId = ScopeId; return(v6.ToString()); } }
/// <summary> /// Overrides System.Object.ToString to return /// this object rendered in a quad-dotted notation /// </summary> public override string ToString () { if(m_Family == AddressFamily.InterNetwork) return ToString (m_Address); else { ushort[] numbers = m_Numbers.Clone() as ushort[]; for(int i=0; i<numbers.Length; i++) numbers[i] = (ushort)NetworkToHostOrder((short)numbers[i]); IPv6Address v6 = new IPv6Address(numbers); v6.ScopeId = ScopeId; return v6.ToString(); } }