Table of Contents

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

BindingFlags

Methods

GetFieldMask<T>(T)

Generates a Field Mask from an object of type T.

public static string GetFieldMask<T>(this T thiz)

Parameters

thiz T

The object.

Returns

string

A string field mask.

Type Parameters

T

The 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 T does 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

member MemberInfo

The member.

namingStrategy NamingStrategy

The naming strategy to use if a defined JSON name was not found.

Returns

string

The JSON name of the member.