ProtocolRange
readonly struct
Represents an inclusive range of protocol numbers.
Declaration
public readonly struct ProtocolRange
| Namespace | McProtoNet.Protocol |
| Assembly | McProtoNet.Protocol.dll |
| Source | src/McProtoNet.Protocol/ProtocolRange.cs#L6 ↗ |
Constructors
| Signature | Description |
|---|---|
ProtocolRange(int from, int to) | Initializes a new instance of the ProtocolRange structure with the specified bounds. |
ProtocolRange(int, int)
public ProtocolRange(int from, int to)
Initializes a new instance of the ProtocolRange structure with the specified bounds.
Parameters: from (Int32), to (Int32)
Properties
| Signature | Description |
|---|---|
int From | Gets the lowest protocol number in the range. |
int To | Gets the highest protocol number in the range. |
From
public int From { get; }
Gets the lowest protocol number in the range.
Returns: Int32
To
public int To { get; }
Gets the highest protocol number in the range.
Returns: Int32
Methods
| Signature | Description |
|---|---|
static bool IsSupported(ProtocolRange[] ranges, int protocol) | Determines whether the specified protocol number falls within any of the specified ranges. |
string ToString() | Returns the string representation of the range. |
IsSupported(ProtocolRange[], int)
public static bool IsSupported(ProtocolRange[] ranges, int protocol)
Determines whether the specified protocol number falls within any of the specified ranges.
Parameters: ranges (ProtocolRange[]), protocol (Int32)
Returns: Boolean - <a href="https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool">true</a> if <code class="paramref">protocol</code> falls within one of <code class="paramref">ranges</code>; otherwise, <a href="https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool">false</a>.
ToString()
public override string ToString()
Returns the string representation of the range.
Returns: String - The single protocol number when both bounds are equal; otherwise, the two bounds separated by a hyphen.