[[["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-28 UTC."],[[["\u003cp\u003eContextRule is a class that provides context information for individual API elements, implementing interfaces such as IMessage, IEquatable, IDeepCloneable, and IBufferMessage.\u003c/p\u003e\n"],["\u003cp\u003eThe ContextRule class has constructors for default initialization and for creating a new instance based on an existing ContextRule object.\u003c/p\u003e\n"],["\u003cp\u003eKey fields in ContextRule include \u003ccode\u003eAllowedRequestExtensionsFieldNumber\u003c/code\u003e, \u003ccode\u003eAllowedResponseExtensionsFieldNumber\u003c/code\u003e, \u003ccode\u003eProvidedFieldNumber\u003c/code\u003e, \u003ccode\u003eRequestedFieldNumber\u003c/code\u003e, and \u003ccode\u003eSelectorFieldNumber\u003c/code\u003e, each defining a field number for specific types of data.\u003c/p\u003e\n"],["\u003cp\u003eThe class features properties like \u003ccode\u003eAllowedRequestExtensions\u003c/code\u003e, \u003ccode\u003eAllowedResponseExtensions\u003c/code\u003e, \u003ccode\u003eProvided\u003c/code\u003e, \u003ccode\u003eRequested\u003c/code\u003e, and \u003ccode\u003eSelector\u003c/code\u003e, which handle lists of type names, extensions, and the selection of methods.\u003c/p\u003e\n"],["\u003cp\u003eMethods of the ContextRule class include \u003ccode\u003eCalculateSize\u003c/code\u003e, \u003ccode\u003eClone\u003c/code\u003e, \u003ccode\u003eEquals\u003c/code\u003e, \u003ccode\u003eGetHashCode\u003c/code\u003e, \u003ccode\u003eMergeFrom\u003c/code\u003e, \u003ccode\u003eToString\u003c/code\u003e, and \u003ccode\u003eWriteTo\u003c/code\u003e, allowing for operations such as calculating the message size, creating deep clones, merging data, and handling input and output streams.\u003c/p\u003e\n"]]],[],null,["# Class ContextRule (2.17.0)\n\nVersion latestkeyboard_arrow_down\n\n- [2.17.0 (latest)](/dotnet/docs/reference/Google.Api.CommonProtos/latest/Google.Api.ContextRule)\n- [2.15.0](/dotnet/docs/reference/Google.Api.CommonProtos/2.15.0/Google.Api.ContextRule)\n- [2.10.0](/dotnet/docs/reference/Google.Api.CommonProtos/2.10.0/Google.Api.ContextRule)\n- [2.2.0](/dotnet/docs/reference/Google.Api.CommonProtos/2.2.0/Google.Api.ContextRule) \n\n public sealed class ContextRule : IMessage\u003cContextRule\u003e, IEquatable\u003cContextRule\u003e, IDeepCloneable\u003cContextRule\u003e, IBufferMessage, IMessage\n\nA context rule provides information about the context for an individual API\nelement. \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e ContextRule \n\nImplements\n----------\n\n[IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage-1.html)[ContextRule](/dotnet/docs/reference/Google.Api.CommonProtos/latest/Google.Api.ContextRule), [IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[ContextRule](/dotnet/docs/reference/Google.Api.CommonProtos/latest/Google.Api.ContextRule), [IDeepCloneable](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IDeepCloneable-1.html)[ContextRule](/dotnet/docs/reference/Google.Api.CommonProtos/latest/Google.Api.ContextRule), [IBufferMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IBufferMessage.html), [IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage.html) \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\nNamespace\n---------\n\n[Google.Api](/dotnet/docs/reference/Google.Api.CommonProtos/latest/Google.Api)\n\nAssembly\n--------\n\nGoogle.Api.CommonProtos.dll\n\nConstructors\n------------\n\n### ContextRule()\n\n public ContextRule()\n\n### ContextRule(ContextRule)\n\n public ContextRule(ContextRule other)\n\nFields\n------\n\n### AllowedRequestExtensionsFieldNumber\n\n public const int AllowedRequestExtensionsFieldNumber = 4\n\nField number for the \"allowed_request_extensions\" field.\n\n### AllowedResponseExtensionsFieldNumber\n\n public const int AllowedResponseExtensionsFieldNumber = 5\n\nField number for the \"allowed_response_extensions\" field.\n\n### ProvidedFieldNumber\n\n public const int ProvidedFieldNumber = 3\n\nField number for the \"provided\" field.\n\n### RequestedFieldNumber\n\n public const int RequestedFieldNumber = 2\n\nField number for the \"requested\" field.\n\n### SelectorFieldNumber\n\n public const int SelectorFieldNumber = 1\n\nField number for the \"selector\" field.\n\nProperties\n----------\n\n### AllowedRequestExtensions\n\n public RepeatedField\u003cstring\u003e AllowedRequestExtensions { get; }\n\nA list of full type names or extension IDs of extensions allowed in grpc\nside channel from client to backend.\n\n### AllowedResponseExtensions\n\n public RepeatedField\u003cstring\u003e AllowedResponseExtensions { get; }\n\nA list of full type names or extension IDs of extensions allowed in grpc\nside channel from backend to client.\n\n### Descriptor\n\n public static MessageDescriptor Descriptor { get; }\n\n### Parser\n\n public static MessageParser\u003cContextRule\u003e Parser { get; }\n\n### Provided\n\n public RepeatedField\u003cstring\u003e Provided { get; }\n\nA list of full type names of provided contexts. It is used to support\npropagating HTTP headers and ETags from the response extension.\n\n### Requested\n\n public RepeatedField\u003cstring\u003e Requested { get; }\n\nA list of full type names of requested contexts, only the requested context\nwill be made available to the backend.\n\n### Selector\n\n public string Selector { get; set; }\n\nSelects the methods to which this rule applies.\n\nRefer to \\[selector\\]\\[google.api.DocumentationRule.selector\\] for syntax\ndetails.\n\nMethods\n-------\n\n### CalculateSize()\n\n public int CalculateSize()\n\n### Clone()\n\n public ContextRule Clone()\n\n### Equals(ContextRule)\n\n public bool Equals(ContextRule other)\n\n### Equals(object)\n\n public override bool Equals(object other)\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\n**Overrides** \n[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode)\n\n### MergeFrom(ContextRule)\n\n public void MergeFrom(ContextRule other)\n\n### MergeFrom(CodedInputStream)\n\n public void MergeFrom(CodedInputStream input)\n\n### ToString()\n\n public override string ToString()\n\n**Overrides** \n[object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)\n\n### WriteTo(CodedOutputStream)\n\n public void WriteTo(CodedOutputStream output)"]]