5

I can use System.Net.IPAddress to represent a single IP Address, but what can I use to represent an entire subnet, including the network address and the subnet mask?

2 Answers 2

2

I believe you can use the System.Net.IPAddress to also represent a subnet mask. It's of the same form, and the only real operation you need to do w/ it is a bitmask based on the bytes of the subnet address.

System.Net.IPAddress i = System.Net.IPAddress.TryParse("10.10.1.1"); Byte[] b = i.GetAddressBytes(); 
Sign up to request clarification or add additional context in comments.

1 Comment

apologies - my question didn't match the title. I've fixed the title.
2
struct NetworkIPAddress { public IPAddress IP; public uint Mask; } 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.