Method TryParseValue
TryParseValue<TValue>(string, out TValue?)
Attempts to parse input into a value of type TValue.
[UnconditionalSuppressMessage("Trimming", "IL2090:'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicMethods' in call to target method.", Justification = "Reflective lookup of static TryParse(string, IFormatProvider?, out T) is intentional. Callers using AOT/trimming with custom IParsable types should preserve the TryParse method via DynamicDependency or equivalent.")]
public static bool TryParseValue<TValue>(string input, out TValue? parsed)
Parameters
inputstringThe string representation to parse.
parsedTValueWhen this method returns true, contains the parsed value; otherwise default.
Returns
Type Parameters
TValueThe target value type. May be a reference type, value type, or Nullable<T>.
Remarks
Supported types:
- string (assigned directly).
- Any type implementing IParsable<TSelf> via reflection on the static
TryParse(string, IFormatProvider?, out T)method. - Nullable<T> wrappers around any of the above.
- Enum types (case-insensitive).