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

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 4)

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

public static T? TryGet<T>(this Match match, params string[] groupNames)
parameter description
T The desired type. See RegexMatchExtensions for supported types.
match The match.
groupNames The group names to return.

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 (3 of 4)

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


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

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

public static bool TryGet<T>(this Match match, string[] groupNames, out T value)
parameter description
T The desired type. See RegexMatchExtensions for supported types.
match The match.
groupNames The group names to return.
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