You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This little class has come to the rescue for the code generated JSON serialization I am performing.
For generics it performs a little differently.
The Modes array kicks in with values from the outer most argument to the innermost.
If you want to know if IEnumerable<string>? is nullable then the following does the trick
public static bool HasNullableAttribute(this PropertyInfo pi)
{
var v = pi.GetCustomAttributes(false)
.OfType<System.Runtime.CompilerServices.NullableAttribute>()
.FirstOrDefault();
if (v != default)
{
if(pi.PropertyType.IsGenericType && (v.Modes?.Length ?? 0) > 0)
{
return v.Modes[0] == 2;
}
return v.Mode == 2;
}
return false;
}
The text was updated successfully, but these errors were encountered:
This little class has come to the rescue for the code generated JSON serialization I am performing.
For generics it performs a little differently.
The Modes array kicks in with values from the outer most argument to the innermost.
If you want to know if
IEnumerable<string>?
is nullable then the following does the trickThe text was updated successfully, but these errors were encountered: