public sealed class Visibility : IMessage<Visibility>, IEquatable<Visibility>, IDeepCloneable<Visibility>, IBufferMessage, IMessage
Visibility restricts service consumer's access to service elements,
such as whether an application can call a visibility-restricted method.
The restriction is expressed by applying visibility labels on service
elements. The visibility labels are elsewhere linked to service consumers.
A service can define multiple visibility labels, but a service consumer
should be granted at most one visibility label. Multiple visibility
labels for a single service consumer are not supported.
If an element and all its parents have no visibility label, its visibility
is unconditionally granted.
[[["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\u003eThe \u003ccode\u003eVisibility\u003c/code\u003e class in the Google.Api.CommonProtos library is used to restrict service consumer access to specific service elements, based on visibility labels.\u003c/p\u003e\n"],["\u003cp\u003eA service can define multiple visibility labels, however only one visibility label is supported per service consumer.\u003c/p\u003e\n"],["\u003cp\u003eIf a service element and its parents have no assigned visibility labels, the service element is considered to be publicly accessible.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eVisibility\u003c/code\u003e class implements interfaces like \u003ccode\u003eIMessage\u003c/code\u003e, \u003ccode\u003eIEquatable\u003c/code\u003e, \u003ccode\u003eIDeepCloneable\u003c/code\u003e, and \u003ccode\u003eIBufferMessage\u003c/code\u003e, and includes methods for cloning, merging, and calculating the size of visibility rules.\u003c/p\u003e\n"],["\u003cp\u003eVisibility rules are configured using a list of \u003ccode\u003eVisibilityRule\u003c/code\u003e objects, and the \u003ccode\u003eRules\u003c/code\u003e property is used to manage these rules, following a "last one wins" order for configuration.\u003c/p\u003e\n"]]],[],null,["# Class Visibility (2.17.0)\n\nVersion latestkeyboard_arrow_down\n\n- [2.17.0 (latest)](/dotnet/docs/reference/Google.Api.CommonProtos/latest/Google.Api.Visibility)\n- [2.15.0](/dotnet/docs/reference/Google.Api.CommonProtos/2.15.0/Google.Api.Visibility)\n- [2.10.0](/dotnet/docs/reference/Google.Api.CommonProtos/2.10.0/Google.Api.Visibility)\n- [2.2.0](/dotnet/docs/reference/Google.Api.CommonProtos/2.2.0/Google.Api.Visibility) \n\n public sealed class Visibility : IMessage\u003cVisibility\u003e, IEquatable\u003cVisibility\u003e, IDeepCloneable\u003cVisibility\u003e, IBufferMessage, IMessage\n\n`Visibility` restricts service consumer's access to service elements,\nsuch as whether an application can call a visibility-restricted method.\nThe restriction is expressed by applying visibility labels on service\nelements. The visibility labels are elsewhere linked to service consumers.\n\nA service can define multiple visibility labels, but a service consumer\nshould be granted at most one visibility label. Multiple visibility\nlabels for a single service consumer are not supported.\n\nIf an element and all its parents have no visibility label, its visibility\nis unconditionally granted.\n\nExample: \n\n visibility:\n rules:\n - selector: google.calendar.Calendar.EnhancedSearch\n restriction: PREVIEW\n - selector: google.calendar.Calendar.Delegate\n restriction: INTERNAL\n\nHere, all methods are publicly visible except for the restricted methods\nEnhancedSearch and Delegate. \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e Visibility \n\nImplements\n----------\n\n[IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage-1.html)[Visibility](/dotnet/docs/reference/Google.Api.CommonProtos/latest/Google.Api.Visibility), [IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[Visibility](/dotnet/docs/reference/Google.Api.CommonProtos/latest/Google.Api.Visibility), [IDeepCloneable](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IDeepCloneable-1.html)[Visibility](/dotnet/docs/reference/Google.Api.CommonProtos/latest/Google.Api.Visibility), [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### Visibility()\n\n public Visibility()\n\n### Visibility(Visibility)\n\n public Visibility(Visibility other)\n\nFields\n------\n\n### RulesFieldNumber\n\n public const int RulesFieldNumber = 1\n\nField number for the \"rules\" field.\n\nProperties\n----------\n\n### Descriptor\n\n public static MessageDescriptor Descriptor { get; }\n\n### Parser\n\n public static MessageParser\u003cVisibility\u003e Parser { get; }\n\n### Rules\n\n public RepeatedField\u003cVisibilityRule\u003e Rules { get; }\n\nA list of visibility rules that apply to individual API elements.\n\n**NOTE:** All service configuration rules follow \"last one wins\" order.\n\nMethods\n-------\n\n### CalculateSize()\n\n public int CalculateSize()\n\n### Clone()\n\n public Visibility Clone()\n\n### Equals(Visibility)\n\n public bool Equals(Visibility 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(Visibility)\n\n public void MergeFrom(Visibility 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)"]]