Code for IP Address Comparison and Conversion in C#?
Answer / Santosh Kumar Bhagat
You can compare two IP addresses using `IPAddress.TryParse()` to convert IP strings to `IPAddress` objects, and then compare them:n```csharpnpublic static bool CompareIP(string ip1, string ip2) {n IPAddress addr1;n IPAddress addr2;n if (!IPAddress.TryParse(ip1, out addr1) || !IPAddress.TryParse(ip2, out addr2)) return false;n return addr1.Equals(addr2);n}nTo convert an IP address to a string representation, you can use the `ToString()` method:n```csharpnstring ip = "255.255.255.0";nIPAddress ipAddr = IPAddress.Parse(ip);nstring ipStr = ipAddr.ToString();n``
| Is This Answer Correct ? | 0 Yes | 0 No |
working with arrays
How to export 2 datatables of a single dataset to 2 different worksheets of a single MSExcel file ?
program for straight line(y=mx+c)
how to change password in .net with c # with ado.net and also SQL server 2008 change password
Code for Working with Files under a Directory?
Event Handling in C# Triggering a Button
Write a program to convert postfix expression to infix expression.
how can i split sting in textbox in windows application using c# .net
program for string reverse(eg:- i am boy -> boy am i)
8 Answers Black Pepper, Infosys, Mind Tree,
How to Link Different Data Sources Together?
"c sharp" code for factorial using static variables
Coding for Manipulate XML File Data Using C#?