Class Mac
Provides validation and generation for MAC addresses.
public static class Mac
- Inheritance
-
Mac
- Inherited Members
Methods
TryGenerate(Span<char>, out int)
Attempts to generate a random MAC address into the provided buffer.
public static bool TryGenerate(Span<char> destination, out int written)
Parameters
destinationSpan<char>Buffer that receives the generated address.
writtenintWhen the method returns, contains the number of characters produced.
Returns
- bool
trueif generation was attempted; otherwise,false.
TryGenerate(in GenerationOptions, Span<char>, out int)
Attempts to generate a random MAC address using the supplied options.
public static bool TryGenerate(in GenerationOptions options, Span<char> destination, out int written)
Parameters
optionsGenerationOptionsOptions controlling generation.
destinationSpan<char>Buffer that receives the generated address.
writtenintWhen the method returns, contains the number of characters produced.
Returns
- bool
trueif generation succeeded; otherwise,false.
TryValidate(ReadOnlySpan<char>, out ValidationResult<MacValue>)
Attempts to validate the supplied input as a MAC address.
public static bool TryValidate(ReadOnlySpan<char> input, out ValidationResult<MacValue> result)
Parameters
inputReadOnlySpan<char>Candidate address to validate.
resultValidationResult<MacValue>The validation outcome including the parsed value when valid.
Returns
- bool
trueif validation succeeded; otherwise,false.