public sealed class Extension<TTarget, TValue> : Extension where TTarget : IExtendableMessage<TTarget>
Represents a type-safe extension identifier used for getting and setting single extension values in IExtendableMessage<T> instances.
This API is experimental and subject to change.
[[["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 latest version of the \u003ccode\u003eExtension<TTarget, TValue>\u003c/code\u003e class is 3.27.1, which is used as a type-safe extension identifier for getting and setting single extension values in \u003ccode\u003eIExtendableMessage<T>\u003c/code\u003e instances.\u003c/p\u003e\n"],["\u003cp\u003eThis API is designated as experimental and is subject to future modifications or changes.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eExtension<TTarget, TValue>\u003c/code\u003e class inherits from the \u003ccode\u003eExtension\u003c/code\u003e class and ultimately from the \u003ccode\u003eobject\u003c/code\u003e class, inheriting methods like \u003ccode\u003eEquals\u003c/code\u003e, \u003ccode\u003eGetHashCode\u003c/code\u003e, and \u003ccode\u003eToString\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eIt is within the \u003ccode\u003eGoogle.Protobuf\u003c/code\u003e namespace and part of the \u003ccode\u003eGoogle.Protobuf.dll\u003c/code\u003e assembly, with type parameters \u003ccode\u003eTTarget\u003c/code\u003e defining the message type and \u003ccode\u003eTValue\u003c/code\u003e defining the field value type.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eExtension\u003c/code\u003e class has a constructor \u003ccode\u003eExtension(int fieldNumber, FieldCodec<TValue> codec)\u003c/code\u003e for creating a new extension identifier using a specified field number and codec.\u003c/p\u003e\n"]]],[],null,["# Class Extension<TTarget, TValue> (3.27.1)\n\nVersion latestkeyboard_arrow_down\n\n- [3.27.1 (latest)](/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.Extension-2)\n- [3.23.0](/dotnet/docs/reference/Google.Protobuf/3.23.0/Google.Protobuf.Extension-2)\n- [3.15.8](/dotnet/docs/reference/Google.Protobuf/3.15.8/Google.Protobuf.Extension-2) \n\n public sealed class Extension\u003cTTarget, TValue\u003e : Extension where TTarget : IExtendableMessage\u003cTTarget\u003e\n\nRepresents a type-safe extension identifier used for getting and setting single extension values in [IExtendableMessage\\\u003cT\\\u003e](/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IExtendableMessage-1) instances.\nThis API is experimental and subject to change. \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e [Extension](/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.Extension) \\\u003e Extension\\\u003cTTarget, TValue\\\u003e \n\nInherited Members\n-----------------\n\n[Extension.FieldNumber](/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.Extension#Google_Protobuf_Extension_FieldNumber) \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.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\nConstructors\n------------\n\n### Extension(int, FieldCodec\\\u003cTValue\\\u003e)\n\n public Extension(int fieldNumber, FieldCodec\u003cTValue\u003e codec)\n\nCreates a new extension identifier with the specified field number and codec"]]