Class ExtensionSet (3.15.8)

public static class ExtensionSet : object

Methods for managing ExtensionSet<TTarget>s with null checking.

Most users will not use this class directly and its API is experimental and subject to change.

Inheritance

Object > ExtensionSet

Namespace

Google.Protobuf

Assembly

Google.Protobuf.dll

Methods

Clear<TTarget, TValue>(ref ExtensionSet<TTarget>, Extension<TTarget, TValue>)

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

Clears the value of the specified extension

Parameters
NameDescription
setExtensionSet<TTarget>
extensionExtension<TTarget, TValue>
Type Parameters
NameDescription
TTarget
TValue

Clear<TTarget, TValue>(ref ExtensionSet<TTarget>, RepeatedExtension<TTarget, TValue>)

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

Clears the value of the specified extension

Parameters
NameDescription
setExtensionSet<TTarget>
extensionRepeatedExtension<TTarget, TValue>
Type Parameters
NameDescription
TTarget
TValue

Clone<TTarget>(ExtensionSet<TTarget>)

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

Parameter
NameDescription
setExtensionSet<TTarget>
Returns
TypeDescription
ExtensionSet<TTarget>
Type Parameter
NameDescription
TTarget

Get<TTarget, TValue>(ref ExtensionSet<TTarget>, Extension<TTarget, TValue>)

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

Gets the value of the specified extension

Parameters
NameDescription
setExtensionSet<TTarget>
extensionExtension<TTarget, TValue>
Returns
TypeDescription
TValue
Type Parameters
NameDescription
TTarget
TValue

Get<TTarget, TValue>(ref ExtensionSet<TTarget>, RepeatedExtension<TTarget, TValue>)

public static RepeatedField<TValue> Get<TTarget, TValue>(ref ExtensionSet<TTarget> 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

Parameters
NameDescription
setExtensionSet<TTarget>
extensionRepeatedExtension<TTarget, TValue>
Returns
TypeDescription
RepeatedField<TValue>
Type Parameters
NameDescription
TTarget
TValue

GetOrInitialize<TTarget, TValue>(ref ExtensionSet<TTarget>, RepeatedExtension<TTarget, TValue>)

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

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

Parameters
NameDescription
setExtensionSet<TTarget>
extensionRepeatedExtension<TTarget, TValue>
Returns
TypeDescription
RepeatedField<TValue>
Type Parameters
NameDescription
TTarget
TValue

Has<TTarget, TValue>(ref ExtensionSet<TTarget>, Extension<TTarget, TValue>)

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

Gets whether the value of the specified extension is set

Parameters
NameDescription
setExtensionSet<TTarget>
extensionExtension<TTarget, TValue>
Returns
TypeDescription
Boolean
Type Parameters
NameDescription
TTarget
TValue

MergeFrom<TTarget>(ref ExtensionSet<TTarget>, ExtensionSet<TTarget>)

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

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

Parameters
NameDescription
firstExtensionSet<TTarget>
secondExtensionSet<TTarget>
Type Parameter
NameDescription
TTarget

Set<TTarget, TValue>(ref ExtensionSet<TTarget>, Extension<TTarget, TValue>, TValue)

public static void Set<TTarget, TValue>(ref ExtensionSet<TTarget> 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.

Parameters
NameDescription
setExtensionSet<TTarget>
extensionExtension<TTarget, TValue>
valueTValue
Type Parameters
NameDescription
TTarget
TValue

TryMergeFieldFrom<TTarget>(ref ExtensionSet<TTarget>, CodedInputStream)

public static bool TryMergeFieldFrom<TTarget>(ref ExtensionSet<TTarget> 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.

Parameters
NameDescription
setExtensionSet<TTarget>
streamCodedInputStream
Returns
TypeDescription
Boolean
Type Parameter
NameDescription
TTarget

TryMergeFieldFrom<TTarget>(ref ExtensionSet<TTarget>, ref ParseContext)

public static bool TryMergeFieldFrom<TTarget>(ref ExtensionSet<TTarget> 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.

Parameters
NameDescription
setExtensionSet<TTarget>
ctxParseContext
Returns
TypeDescription
Boolean
Type Parameter
NameDescription
TTarget