Class GeminiFieldMaskGenerator
Extension to generate a Field Mask from any object.
public static class GeminiFieldMaskGenerator
- Inheritance
-
GeminiFieldMaskGenerator
Fields
s_publicInstanceMembers
Binding flags for accessing public instance members.
private static readonly BindingFlags s_publicInstanceMembers
Field Value
Methods
GetFieldMask<T>(T)
Generates a Field Mask from an object of type T.
public static string GetFieldMask<T>(this T thiz)
Parameters
thizTThe object.
Returns
- string
A string field mask.
Type Parameters
TThe type.
Remarks
This is a reflection heavy process. Also, this only works if the default value off all fields and properties in T is null.
Exceptions
- NotImplementedException
Thrown if
Tdoes not implement JsonObjectAttribute or has no defined NamingStrategy.
GetJsonMemberName(MemberInfo, NamingStrategy)
Gets the JSON name of a type member as defined in its JsonPropertyAttribute, or uses a NamingStrategy to convert its name.
private static string GetJsonMemberName(MemberInfo member, NamingStrategy namingStrategy)
Parameters
memberMemberInfoThe member.
namingStrategyNamingStrategyThe naming strategy to use if a defined JSON name was not found.
Returns
- string
The JSON name of the member.