| |

VerySource

 Forgot password?
 Register
Search
View: 685|Reply: 2

Seeking VB.net to C #

[Copy link]

1

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-1-16 02:40:01
| Show all posts |Read mode
Please help convert the following VB code into C #
 2 Dim Ip As String = "61.175.232.30"
 3 'Take out the IP address and remove the'. 'String array
 4 Dim Ip_List () As String = Ip.Split (".". ToCharArray ())
 5 Dim X_Ip As String = ""
 6 'loop array, convert data to hexadecimal number, and merge array (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 'Convert hexadecimal number to decimal number (1034938398)
13 Dim N_Ip As Long = Long.Parse (X_Ip, System.Globalization.NumberStyles.HexNumber)
Reply

Use magic Report

0

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-1-21 14:45:01
| Show all posts
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);
Reply

Use magic Report

1

Threads

10

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

Post time: 2020-2-2 00:54:01
| Show all posts
hoho ~~~~
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list