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.
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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["\u003cp\u003eThe \u003ccode\u003eExtensionSet\u003c/code\u003e class provides methods for managing \u003ccode\u003eExtensionSet<TTarget>\u003c/code\u003e with null checking within the Google.Protobuf namespace.\u003c/p\u003e\n"],["\u003cp\u003eMost users will not directly interact with the \u003ccode\u003eExtensionSet\u003c/code\u003e class, as its API is considered experimental and subject to change.\u003c/p\u003e\n"],["\u003cp\u003eMethods in \u003ccode\u003eExtensionSet\u003c/code\u003e allow operations like clearing, cloning, getting, setting, checking if set, merging, and handling fields from a coded input stream, primarily through reference modification of \u003ccode\u003eExtensionSet<TTarget>\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe class supports various generic types, such as \u003ccode\u003eTTarget\u003c/code\u003e and \u003ccode\u003eTValue\u003c/code\u003e, used in managing different types of extensions and their values.\u003c/p\u003e\n"],["\u003cp\u003eThere are multiple versions of \u003ccode\u003eExtensionSet\u003c/code\u003e, including the latest (3.27.1) and older ones (3.23.0, 3.15.8), accessible through different documentation links.\u003c/p\u003e\n"]]],[],null,["# Class ExtensionSet (3.27.1)\n\nVersion latestkeyboard_arrow_down\n\n- [3.27.1 (latest)](/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.ExtensionSet)\n- [3.23.0](/dotnet/docs/reference/Google.Protobuf/3.23.0/Google.Protobuf.ExtensionSet)\n- [3.15.8](/dotnet/docs/reference/Google.Protobuf/3.15.8/Google.Protobuf.ExtensionSet) \n\n public static class ExtensionSet\n\nMethods for managing [ExtensionSet\\\u003cTTarget\\\u003e](/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.ExtensionSet-1)s with null checking.\n\nMost users will not use this class directly and its API is experimental and subject to change. \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e ExtensionSet \n\nInherited Members\n-----------------\n\n[object.Equals(object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)) \n[object.Equals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)) \n[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) \n[object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) \n[object.MemberwiseClone()](https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone) \n[object.ReferenceEquals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.referenceequals) \n[object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)\n\nNamespace\n---------\n\n[Google.Protobuf](/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf)\n\nAssembly\n--------\n\nGoogle.Protobuf.dll\n\nMethods\n-------\n\n### Clear\\\u003cTTarget, TValue\\\u003e(ref ExtensionSet\\\u003cTTarget\\\u003e, Extension\\\u003cTTarget, TValue\\\u003e)\n\n public static void Clear\u003cTTarget, TValue\u003e(ref ExtensionSet\u003cTTarget\u003e set, Extension\u003cTTarget, TValue\u003e extension) where TTarget : IExtendableMessage\u003cTTarget\u003e\n\nClears the value of the specified extension\n\n### Clear\\\u003cTTarget, TValue\\\u003e(ref ExtensionSet\\\u003cTTarget\\\u003e, RepeatedExtension\\\u003cTTarget, TValue\\\u003e)\n\n public static void Clear\u003cTTarget, TValue\u003e(ref ExtensionSet\u003cTTarget\u003e set, RepeatedExtension\u003cTTarget, TValue\u003e extension) where TTarget : IExtendableMessage\u003cTTarget\u003e\n\nClears the value of the specified extension\n\n### Clone\\\u003cTTarget\\\u003e(ExtensionSet\\\u003cTTarget\\\u003e)\n\n public static ExtensionSet\u003cTTarget\u003e Clone\u003cTTarget\u003e(ExtensionSet\u003cTTarget\u003e set) where TTarget : IExtendableMessage\u003cTTarget\u003e\n\nClones the set into a new set. If the set is null, this returns null\n\n### GetOrInitialize\\\u003cTTarget, TValue\\\u003e(ref ExtensionSet\\\u003cTTarget\\\u003e, RepeatedExtension\\\u003cTTarget, TValue\\\u003e)\n\n public static RepeatedField\u003cTValue\u003e GetOrInitialize\u003cTTarget, TValue\u003e(ref ExtensionSet\u003cTTarget\u003e set, RepeatedExtension\u003cTTarget, TValue\u003e extension) where TTarget : IExtendableMessage\u003cTTarget\u003e\n\nGets the value of the specified repeated extension, registering it if it doesn't exist\n\n### Get\\\u003cTTarget, TValue\\\u003e(ref ExtensionSet\\\u003cTTarget\\\u003e, Extension\\\u003cTTarget, TValue\\\u003e)\n\n public static TValue Get\u003cTTarget, TValue\u003e(ref ExtensionSet\u003cTTarget\u003e set, Extension\u003cTTarget, TValue\u003e extension) where TTarget : IExtendableMessage\u003cTTarget\u003e\n\nGets the value of the specified extension\n\n### Get\\\u003cTTarget, TValue\\\u003e(ref ExtensionSet\\\u003cTTarget\\\u003e, RepeatedExtension\\\u003cTTarget, TValue\\\u003e)\n\n public static RepeatedField\u003cTValue\u003e Get\u003cTTarget, TValue\u003e(ref ExtensionSet\u003cTTarget\u003e set, RepeatedExtension\u003cTTarget, TValue\u003e extension) where TTarget : IExtendableMessage\u003cTTarget\u003e\n\nGets the value of the specified repeated extension or null if it doesn't exist in this set\n\n### Has\\\u003cTTarget, TValue\\\u003e(ref ExtensionSet\\\u003cTTarget\\\u003e, Extension\\\u003cTTarget, TValue\\\u003e)\n\n public static bool Has\u003cTTarget, TValue\u003e(ref ExtensionSet\u003cTTarget\u003e set, Extension\u003cTTarget, TValue\u003e extension) where TTarget : IExtendableMessage\u003cTTarget\u003e\n\nGets whether the value of the specified extension is set\n\n### MergeFrom\\\u003cTTarget\\\u003e(ref ExtensionSet\\\u003cTTarget\\\u003e, ExtensionSet\\\u003cTTarget\\\u003e)\n\n public static void MergeFrom\u003cTTarget\u003e(ref ExtensionSet\u003cTTarget\u003e first, ExtensionSet\u003cTTarget\u003e second) where TTarget : IExtendableMessage\u003cTTarget\u003e\n\nMerges the second set into the first set, creating a new instance if first is null\n\n### Set\\\u003cTTarget, TValue\\\u003e(ref ExtensionSet\\\u003cTTarget\\\u003e, Extension\\\u003cTTarget, TValue\\\u003e, TValue)\n\n public static void Set\u003cTTarget, TValue\u003e(ref ExtensionSet\u003cTTarget\u003e set, Extension\u003cTTarget, TValue\u003e extension, TValue value) where TTarget : IExtendableMessage\u003cTTarget\u003e\n\nSets the value of the specified extension. This will make a new instance of ExtensionSet if the set is null.\n\n### TryMergeFieldFrom\\\u003cTTarget\\\u003e(ref ExtensionSet\\\u003cTTarget\\\u003e, CodedInputStream)\n\n public static bool TryMergeFieldFrom\u003cTTarget\u003e(ref ExtensionSet\u003cTTarget\u003e set, CodedInputStream stream) where TTarget : IExtendableMessage\u003cTTarget\u003e\n\nTries to merge a field from the coded input, returning true if the field was merged.\nIf the set is null or the field was not otherwise merged, this returns false.\n\n### TryMergeFieldFrom\\\u003cTTarget\\\u003e(ref ExtensionSet\\\u003cTTarget\\\u003e, ref ParseContext)\n\n public static bool TryMergeFieldFrom\u003cTTarget\u003e(ref ExtensionSet\u003cTTarget\u003e set, ref ParseContext ctx) where TTarget : IExtendableMessage\u003cTTarget\u003e\n\nTries to merge a field from the coded input, returning true if the field was merged.\nIf the set is null or the field was not otherwise merged, this returns false."]]