Method TryGetString
- Namespace
- Xunit.Sdk
- Assembly
- xunit.v3.common.dll
TryGetString(IReadOnlyDictionary<string, object?>, string, bool)
Tries to get a string value from a deserialized JSON object.
public static string? TryGetString(IReadOnlyDictionary<string, object?> obj, string key, bool defaultEmptyString = false)
Parameters
objIReadOnlyDictionary<string, object>The deserialized JSON object
keystringThe key for the value
defaultEmptyStringboolFlag to indicate if a default empty string should be returned instead of
null
Returns
- string
Returns the value if present;
null, otherwise.
TryGetString(object?, bool)
Tries to get an long value from a deserialized JSON value.
public static string? TryGetString(object? value, bool defaultEmptyString = false)
Parameters
valueobjectThe deserialized JSON value
defaultEmptyStringboolFlag to indicate if a default empty string should be returned instead of
null
Returns
- string
Returns the value if present;
null, otherwise.