Class ExtensionRegistry (3.23.0)

public sealed class ExtensionRegistry : ICollection<Extension>, IEnumerable<Extension>, IEnumerable, IDeepCloneable<ExtensionRegistry>

Provides extensions to messages while parsing. This API is experimental and subject to change.

Inheritance

object > ExtensionRegistry

Namespace

Google.Protobuf

Assembly

Google.Protobuf.dll

Constructors

ExtensionRegistry()

public ExtensionRegistry()

Creates a new empty extension registry

Properties

Count

public int Count { get; }

Gets the total number of extensions in this extension registry

Property Value
TypeDescription
int

Methods

Add(Extension)

public void Add(Extension extension)

Adds the specified extension to the registry

Parameter
NameDescription
extensionExtension

AddRange(IEnumerable<Extension>)

public void AddRange(IEnumerable<Extension> extensions)

Adds the specified extensions to the registry

Parameter
NameDescription
extensionsIEnumerableExtension

Clear()

public void Clear()

Clears the registry of all values

Clone()

public ExtensionRegistry Clone()

Clones the registry into a new registry

Returns
TypeDescription
ExtensionRegistry

Contains(Extension)

public bool Contains(Extension item)

Gets whether the extension registry contains the specified extension

Parameter
NameDescription
itemExtension
Returns
TypeDescription
bool

GetEnumerator()

public IEnumerator<Extension> GetEnumerator()

Returns an enumerator to enumerate through the items in the registry

Returns
TypeDescription
IEnumeratorExtension

Returns an enumerator for the extensions in this registry

Remove(Extension)

public bool Remove(Extension item)

Removes the specified extension from the set

Parameter
NameDescription
itemExtension

The extension

Returns
TypeDescription
bool

true if the extension was removed, otherwise false