<PackageReference Include="Google.Protobuf" Version="3.34.0" />

Google.Protobuf.ExtensionSet

public static class ExtensionSet
Methods for managing ExtensionSet<T>s with null checking.
public static void Clear<TTarget, TValue>(ref ExtensionSet set, Extension<TTarget, TValue> extension) where TTarget : IExtendableMessage<TTarget>

Clears the value of the specified extension

public static void Clear<TTarget, TValue>(ref ExtensionSet set, RepeatedExtension<TTarget, TValue> extension) where TTarget : IExtendableMessage<TTarget>

Clears the value of the specified extension

public static ExtensionSet<TTarget> Clone<TTarget>(ExtensionSet<TTarget> set) where TTarget : IExtendableMessage<TTarget>

Clones the set into a new set. If the set is null, this returns null

public static TValue Get<TTarget, TValue>(ref ExtensionSet set, Extension<TTarget, TValue> extension) where TTarget : IExtendableMessage<TTarget>

Gets the value of the specified extension

public static RepeatedField<TValue> Get<TTarget, TValue>(ref ExtensionSet set, RepeatedExtension<TTarget, TValue> extension) where TTarget : IExtendableMessage<TTarget>

Gets the value of the specified repeated extension or null if it doesn't exist in this set

public static RepeatedField<TValue> GetOrInitialize<TTarget, TValue>(ref ExtensionSet set, RepeatedExtension<TTarget, TValue> extension) where TTarget : IExtendableMessage<TTarget>

Gets the value of the specified repeated extension, registering it if it doesn't exist

public static bool Has<TTarget, TValue>(ref ExtensionSet set, Extension<TTarget, TValue> extension) where TTarget : IExtendableMessage<TTarget>

Gets whether the value of the specified extension is set

public static void MergeFrom<TTarget>(ref ExtensionSet first, ExtensionSet<TTarget> second) where TTarget : IExtendableMessage<TTarget>

Merges the second set into the first set, creating a new instance if first is null

public static void Set<TTarget, TValue>(ref ExtensionSet set, Extension<TTarget, TValue> extension, TValue value) where TTarget : IExtendableMessage<TTarget>

Sets the value of the specified extension. This will make a new instance of ExtensionSet if the set is null.

public static bool TryMergeFieldFrom<TTarget>(ref ExtensionSet set, CodedInputStream stream) where TTarget : IExtendableMessage<TTarget>

Tries to merge a field from the coded input, returning true if the field was merged. If the set is null or the field was not otherwise merged, this returns false.

public static bool TryMergeFieldFrom<TTarget>(ref ExtensionSet set, ref ParseContext ctx) where TTarget : IExtendableMessage<TTarget>

Tries to merge a field from the coded input, returning true if the field was merged. If the set is null or the field was not otherwise merged, this returns false.