<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
  <CodeSnippet Format="1.0.0">
    <Header>
      <Title>Test an Ip Address to see if it's contained in a subnet</Title>
      <Shortcut>TestanIpAddresstoseeifit'scontainedinasubnet</Shortcut>
      <Description>Test an Ip Address to see if it's contained in a subnet [VB.NET]</Description>
      <Author>Mark Brackett</Author>
      <HelpUrl>/PreviewSnippet.aspx?SnippetID=60f04190-c4cc-4e83-ba6c-23239503fd60</HelpUrl>
      <SnippetTypes>
        <SnippetType>SurroundsWith</SnippetType>
      </SnippetTypes>
    </Header>
    <Snippet>
      <Code Language="VB"><![CDATA[	Public Function ContainsAddress(ByVal ip As Net.IPAddress) As Boolean
		' Could just use ip.Address, but it's marked as Obsolete
		Return ((BitConverter.ToInt32(HostAddress.GetAddressBytes, 0) And BitConverter.ToInt32(SubnetMask.GetAddressBytes, 0)) _
		 = (BitConverter.ToInt32(ip.GetAddressBytes, 0) And BitConverter.ToInt32(SubnetMask.GetAddressBytes, 0)))
	End Function]]></Code>
    </Snippet>
  </CodeSnippet>
</CodeSnippets>