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. |
The corresponding value if the match was successful; default(T) otherwise.
| exception | condition |
|---|---|
| FormatException | The text of the capture cannot be parsed as the specified type. |
| InvalidOperationException | The specified type is not supported. |
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. |
The corresponding value if the match was successful; default(T) otherwise.
| exception | condition |
|---|---|
| FormatException | The text of the capture cannot be parsed as the specified type. |
| InvalidOperationException | The specified type is not supported. |
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. |
True if the match was successful; false otherwise.
| exception | condition |
|---|---|
| FormatException | The text of the capture cannot be parsed as the specified type. |
| InvalidOperationException | The specified type is not supported. |
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. |
True if the match was successful; false otherwise.
| exception | condition |
|---|---|
| FormatException | The text of the capture cannot be parsed as the specified type. |
| InvalidOperationException | The specified type is not supported. |