Using the IPAddress class with masks?

  • Thread starter Thread starter Grandma Wilkerson
  • Start date Start date
G

Grandma Wilkerson

Hi,

This is your grandmother.

I'm have a situation where I have access to an IPAddress and a mask and
need to determine if another IP address is included in the IP block
specified by former IP address and mask. The function prototype looks
something like this:

bool IsIPAddressInBlock(IPAddress neworkID,IPAddress mask,IPAddress test){
//TODO:?
}

I understand conceptually what an IP address and mask are, but I'm not
sure how to analyze the individual bits of the networkID and mask.

Granny
 
I tried:

{
return (test.Address & mask.Address)==networkID.Address;
}

.... but I get compiler errors stating that the Address property is
"obsolete"?

Granny
 
Back
Top