@@ -12,44 +12,6 @@ namespace System.Net;
1212/// </summary>
1313public sealed partial class IPNetwork2
1414{
15- /// <summary>
16- /// Determines whether the given IP address is part of the given IP network.
17- /// </summary>
18- /// <param name="network">The IP network.</param>
19- /// <param name="ipaddress">The IP address.</param>
20- /// <returns>
21- /// <c>true</c> if the IP address is part of the IP network; otherwise, <c>false</c>.
22- /// </returns>
23- [ Obsolete ( "static Contains is deprecated, please use instance Contains." ) ]
24- public static bool Contains ( IPNetwork2 network , IPAddress ipaddress )
25- {
26- if ( network == null )
27- {
28- throw new ArgumentNullException ( nameof ( network ) ) ;
29- }
30-
31- return network . Contains ( ipaddress ) ;
32- }
33-
34- /// <summary>
35- /// Determines if the given <paramref name="network"/> contains the specified <paramref name="network2"/>.
36- /// </summary>
37- /// <param name="network">The network to check for containment.</param>
38- /// <param name="network2">The network to check if it is contained.</param>
39- /// <returns>
40- /// <c>true</c> if the <paramref name="network"/> contains the <paramref name="network2"/>; otherwise, <c>false</c>.
41- /// </returns>
42- [ Obsolete ( "static Contains is deprecated, please use instance Contains." ) ]
43- public static bool Contains ( IPNetwork2 network , IPNetwork2 network2 )
44- {
45- if ( network == null )
46- {
47- throw new ArgumentNullException ( nameof ( network ) ) ;
48- }
49-
50- return network . Contains ( network2 ) ;
51- }
52-
5315 /// <summary>
5416 /// return true if ipaddress is contained in network.
5517 /// </summary>
@@ -106,6 +68,38 @@ public bool Contains(IPNetwork2 contains)
10668 return result ;
10769 }
10870
71+ /// <summary>
72+ /// return true if ipaddress is contained in network.
73+ /// </summary>
74+ /// <param name="network">The network.</param>
75+ /// <param name="ipaddress">The ip address to test.</param>
76+ /// <returns>true if ipaddress is contained into the IP Network; otherwise, false.</returns>
77+ public static bool Contains ( IPNetwork2 network , IPAddress ipaddress )
78+ {
79+ if ( network == null )
80+ {
81+ throw new ArgumentNullException ( nameof ( network ) ) ;
82+ }
83+
84+ return network . Contains ( ipaddress ) ;
85+ }
86+
87+ /// <summary>
88+ /// return true is network2 is fully contained in network.
89+ /// </summary>
90+ /// <param name="network">The network.</param>
91+ /// <param name="network2">The network to test.</param>
92+ /// <returns>true if network2 is contained into the IP Network; otherwise, false.</returns>
93+ public static bool Contains ( IPNetwork2 network , IPNetwork2 network2 )
94+ {
95+ if ( network == null )
96+ {
97+ throw new ArgumentNullException ( nameof ( network ) ) ;
98+ }
99+
100+ return network . Contains ( network2 ) ;
101+ }
102+
109103 private static BigInteger CreateBroadcast ( ref BigInteger network , BigInteger netmask , AddressFamily family )
110104 {
111105 int width = family == AddressFamily . InterNetwork ? 4 : 16 ;
0 commit comments