Class ExtensionSet
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
System.Object
ExtensionSet
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Assembly: Google.Protobuf.dll
Syntax
public static class ExtensionSet
Methods
Clear<TTarget, TValue>(ref ExtensionSet<TTarget>, Extension<TTarget, TValue>)
Clears the value of the specified extension
Declaration
public static void Clear<TTarget, TValue>(ref ExtensionSet<TTarget> set, Extension<TTarget, TValue> extension)
where TTarget : IExtendableMessage<TTarget>
Parameters
Type Parameters
Name |
Description |
TTarget |
|
TValue |
|
Clear<TTarget, TValue>(ref ExtensionSet<TTarget>, RepeatedExtension<TTarget, TValue>)
Clears the value of the specified extension
Declaration
public static void Clear<TTarget, TValue>(ref ExtensionSet<TTarget> set, RepeatedExtension<TTarget, TValue> extension)
where TTarget : IExtendableMessage<TTarget>
Parameters
Type Parameters
Name |
Description |
TTarget |
|
TValue |
|
Clone<TTarget>(ExtensionSet<TTarget>)
Clones the set into a new set. If the set is null, this returns null
Declaration
public static ExtensionSet<TTarget> Clone<TTarget>(ExtensionSet<TTarget> set)
where TTarget : IExtendableMessage<TTarget>
Parameters
Returns
Type Parameters
Get<TTarget, TValue>(ref ExtensionSet<TTarget>, Extension<TTarget, TValue>)
Gets the value of the specified extension
Declaration
public static TValue Get<TTarget, TValue>(ref ExtensionSet<TTarget> set, Extension<TTarget, TValue> extension)
where TTarget : IExtendableMessage<TTarget>
Parameters
Returns
Type Parameters
Name |
Description |
TTarget |
|
TValue |
|
Get<TTarget, TValue>(ref ExtensionSet<TTarget>, RepeatedExtension<TTarget, TValue>)
Gets the value of the specified repeated extension or null if it doesn't exist in this set
Declaration
public static RepeatedField<TValue> Get<TTarget, TValue>(ref ExtensionSet<TTarget> set, RepeatedExtension<TTarget, TValue> extension)
where TTarget : IExtendableMessage<TTarget>
Parameters
Returns
Type Parameters
Name |
Description |
TTarget |
|
TValue |
|
GetOrInitialize<TTarget, TValue>(ref ExtensionSet<TTarget>, RepeatedExtension<TTarget, TValue>)
Gets the value of the specified repeated extension, registering it if it doesn't exist
Declaration
public static RepeatedField<TValue> GetOrInitialize<TTarget, TValue>(ref ExtensionSet<TTarget> set, RepeatedExtension<TTarget, TValue> extension)
where TTarget : IExtendableMessage<TTarget>
Parameters
Returns
Type Parameters
Name |
Description |
TTarget |
|
TValue |
|
Has<TTarget, TValue>(ref ExtensionSet<TTarget>, Extension<TTarget, TValue>)
Gets whether the value of the specified extension is set
Declaration
public static bool Has<TTarget, TValue>(ref ExtensionSet<TTarget> set, Extension<TTarget, TValue> extension)
where TTarget : IExtendableMessage<TTarget>
Parameters
Returns
Type |
Description |
System.Boolean |
|
Type Parameters
Name |
Description |
TTarget |
|
TValue |
|
MergeFrom<TTarget>(ref ExtensionSet<TTarget>, ExtensionSet<TTarget>)
Merges the second set into the first set, creating a new instance if first is null
Declaration
public static void MergeFrom<TTarget>(ref ExtensionSet<TTarget> first, ExtensionSet<TTarget> second)
where TTarget : IExtendableMessage<TTarget>
Parameters
Type Parameters
Set<TTarget, TValue>(ref ExtensionSet<TTarget>, Extension<TTarget, TValue>, TValue)
Sets the value of the specified extension. This will make a new instance of ExtensionSet if the set is null.
Declaration
public static void Set<TTarget, TValue>(ref ExtensionSet<TTarget> set, Extension<TTarget, TValue> extension, TValue value)
where TTarget : IExtendableMessage<TTarget>
Parameters
Type Parameters
Name |
Description |
TTarget |
|
TValue |
|
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.
Declaration
public static bool TryMergeFieldFrom<TTarget>(ref ExtensionSet<TTarget> set, CodedInputStream stream)
where TTarget : IExtendableMessage<TTarget>
Parameters
Returns
Type |
Description |
System.Boolean |
|
Type Parameters