ThrowIfNotGuid Method
Definition
ThrowIfNotGuid(string, GuidFormats, string, string)
Validates and throws an ArgumentException if the specified argument does not have the format of a Guid.
public static void ThrowIfNotGuid(string argument, GuidFormats format = GuidFormats.D | GuidFormats.B | GuidFormats.P, string message = "Value must be a Guid.", string paramName = null)
Parameters
argumentstringThe value to be evaluated.
formatGuidFormatsA bitmask comprised of one or more GuidFormats that specify how the GUID parsing is conducted.
messagestringA message that describes the error.
paramNamestringThe name of the parameter that caused the exception.
Exceptions
- ArgumentException
argumentmust be a Guid.