[[["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\u003e\u003ccode\u003eExtensionSet<TTarget>\u003c/code\u003e is a class used for managing extensions within messages that implement \u003ccode\u003eIExtendableMessage<T>\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe class is part of the \u003ccode\u003eGoogle.Protobuf\u003c/code\u003e namespace in the \u003ccode\u003eGoogle.Protobuf.dll\u003c/code\u003e assembly and is typically not directly used by most users.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eExtensionSet<TTarget>\u003c/code\u003e provides methods to calculate the size of the extension set, check for equality, obtain a hash code, and write the extension values to an output stream or write context.\u003c/p\u003e\n"],["\u003cp\u003eThe class defines \u003ccode\u003eTTarget\u003c/code\u003e as the message type that extensions target, and it inherits from \u003ccode\u003eobject\u003c/code\u003e, overriding the \u003ccode\u003eEquals(object)\u003c/code\u003e and \u003ccode\u003eGetHashCode()\u003c/code\u003e methods.\u003c/p\u003e\n"],["\u003cp\u003eThis page documents multiple versions of this class, with the latest one being version 3.27.1.\u003c/p\u003e\n"]]],[],null,["# Class ExtensionSet<TTarget> (3.27.1)\n\nVersion latestkeyboard_arrow_down\n\n- [3.27.1 (latest)](/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.ExtensionSet-1)\n- [3.23.0](/dotnet/docs/reference/Google.Protobuf/3.23.0/Google.Protobuf.ExtensionSet-1)\n- [3.15.8](/dotnet/docs/reference/Google.Protobuf/3.15.8/Google.Protobuf.ExtensionSet-1) \n\n public sealed class ExtensionSet\u003cTTarget\u003e where TTarget : IExtendableMessage\u003cTTarget\u003e\n\nUsed for keeping track of extensions in messages.\n[IExtendableMessage\\\u003cT\\\u003e](/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IExtendableMessage-1) methods route to this set.\n\nMost users will not need to use this class directly \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e ExtensionSet\\\u003cTTarget\\\u003e \n\nInherited Members\n-----------------\n\n[object.Equals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)) \n[object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) \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### CalculateSize()\n\n public int CalculateSize()\n\nCalculates the size of this extension set\n\n### Equals(object)\n\n public override bool Equals(object other)\n\nReturns whether this set is equal to the other object\n\n**Overrides** \n[object.Equals(object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object))\n\n### GetHashCode()\n\n public override int GetHashCode()\n\nGets a hash code of the set\n\n**Overrides** \n[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode)\n\n### WriteTo(CodedOutputStream)\n\n public void WriteTo(CodedOutputStream stream)\n\nWrites the extension values in this set to the output stream\n\n### WriteTo(ref WriteContext)\n\n public void WriteTo(ref WriteContext ctx)\n\nWrites the extension values in this set to the write context"]]