/**/ /// <summary>///将IP的值转换为IP地址/// </summary>/// <param name="ipLong">要进行转换的IP值</param>/// <returns>string转换后的IP地址</returns> public string ConvertToIP( long ipLong) ... { string strip=""; string ip1,ip2,ip3,ip4; ip1=int.Parse(ipLong / 16777216);//16777216=2^24 ip2=int.Parse(ipLong % 16777216 / 65536);//65536=2^16 ip3=int.Parse((ipLong % 16777216 % 65536)/256);//256=2^8; ip4=int.Parse(ipLong%16777216 % 65536%256); strip=ip1.ToString()+"."+ip2.ToString()+"."+ip3.ToString()+"."+ip4.ToString(); return strip; } /**/ /// <summary>///将IP地址转换为IP的值/// </summary>/// <param name="ip">要进行转换的IP地址</param>/// <returns>long 转换后的IP地址的值</returns> public long ConvertToIPValue( string ip) ... { string [] ipList=ip.Split('.'); long ipvalue=long.Parse(ipList[3])+long.Parse(ipList[2])*256+long.Parse(ipList[1])*256*256+long.Parse(ipList[0])*256*256*256; return ipvalue;}