RegexMatchExtensions.TryGet<T> method (1 of 2)

Attempts to return a value of the specified type for the match.

public static T TryGet<T>(this Match match)
parameter description
T The desired type. See RegexMatchExtensions for supported types.
match The match.

Return Value

The corresponding value if the match was successful; default(T) otherwise.

Exceptions

exception condition
FormatException The text of the capture cannot be parsed as the specified type.
InvalidOperationException The specified type is not supported.

See Also


RegexMatchExtensions.TryGet<T> method (2 of 2)

Attempts to return a value of the specified type for the match.

public static bool TryGet<T>(this Match match, out T value)
parameter description
T The desired type. See RegexMatchExtensions for supported types.
match The match.
value The returned value.

Return Value

True if the match was successful; false otherwise.

Exceptions

exception condition
FormatException The text of the capture cannot be parsed as the specified type.
InvalidOperationException The specified type is not supported.

See Also