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