IPNetwork.Parse Method

Definition

Overloads

Parse(ReadOnlySpan<Char>)

Converts a CIDR character span to an IPNetwork instance.

Parse(String)

Converts a CIDR String to an IPNetwork instance.

Parse(ReadOnlySpan<Char>)

Source:
IPNetwork.cs
Source:
IPNetwork.cs

Converts a CIDR character span to an IPNetwork instance.

C#
public static System.Net.IPNetwork Parse(ReadOnlySpan<char> s);

Parameters

s
ReadOnlySpan<Char>

A character span that defines an IP network in CIDR notation.

Returns

An IPNetwork instance.

Exceptions

s is not a valid CIDR network string, or the address contains non-zero bits after the network prefix.

Applies to

.NET 9 and .NET 8
Product Versions
.NET 8, 9

Parse(String)

Source:
IPNetwork.cs
Source:
IPNetwork.cs

Converts a CIDR String to an IPNetwork instance.

C#
public static System.Net.IPNetwork Parse(string s);

Parameters

s
String

A String that defines an IP network in CIDR notation.

Returns

An IPNetwork instance.

Exceptions

The specified string is null.

s is not a valid CIDR network string, or the address contains non-zero bits after the network prefix.

Applies to

.NET 9 and .NET 8
Product Versions
.NET 8, 9