20分求VB.net转C#
请帮忙将以下VB代码转成C#
2 Dim Ip As String = "61.175.232.30 "
3 '取出IP地址去掉‘.’后的string数组
4 Dim Ip_List() As String = Ip.Split( ". ".ToCharArray())
5 Dim X_Ip As String = " "
6 '循环数组,把数据转换成十六进制数,并合并数组(3dafe81e)
7 Dim ip As String
8 For Each ip In Ip_List
9 X_Ip += Convert.ToInt16 (ip).ToString ( "x ")
10 Next
11
12 '将十六进制数转换成十进制数(1034938398)
13 Dim N_Ip As Long = Long.Parse(X_Ip,System.Globalization.NumberStyles.HexNumber)
------解决方案--------------------string ip = "61.175.232.30 ";
string[] ip_List = ip.Split( ". ".ToCharArray());
string X_ip= " ";
foreach(string ip_item in ip_List)
{
X_ip += Convert.ToInt16(ip_item).ToString( "x ");
}
long N_ip = long.Parse(X_ip, System.Globalization.NumberStyles.HexNumber);