public sealed class LocationName : IResourceName, IEquatable<LocationName>
Resource name for the 'location' resource which is widespread across Google Cloud.
While most resource names are generated on a per-API basis, many APIs use a location resource, and it's
useful to be able to pass values from one API to another.
If true will successfully store an unparseable resource name into the UnparsedResource
property; otherwise will throw an ArgumentException if an unparseable resource name is
specified.
If true will successfully store an unparseable resource name into the UnparsedResource
property; otherwise will throw an ArgumentException if an unparseable resource name is
specified.
[[["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\u003eLocationName\u003c/code\u003e class represents a resource name for locations across Google Cloud, enabling the passing of values between different APIs.\u003c/p\u003e\n"],["\u003cp\u003eThe latest version available for \u003ccode\u003eLocationName\u003c/code\u003e is 4.10.0, with several prior versions also documented, including 4.8.0, 4.4.0, and down to 3.2.0.\u003c/p\u003e\n"],["\u003cp\u003eA \u003ccode\u003eLocationName\u003c/code\u003e instance can be created by providing a \u003ccode\u003eprojectId\u003c/code\u003e and \u003ccode\u003elocationId\u003c/code\u003e, or through parsing a string in the format \u003ccode\u003eprojects/{project}/locations/{location}\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe class offers methods to format IDs into a string representation, parse strings into \u003ccode\u003eLocationName\u003c/code\u003e instances, and handle unparsed resource names if necessary.\u003c/p\u003e\n"],["\u003cp\u003eIt implements the \u003ccode\u003eIResourceName\u003c/code\u003e interface and the generic \u003ccode\u003eIEquatable\u003c/code\u003e interface, providing methods for comparison and equality checks, and it has properties to access \u003ccode\u003eprojectId\u003c/code\u003e, \u003ccode\u003elocationId\u003c/code\u003e, and to check if it has a known pattern.\u003c/p\u003e\n"]]],[],null,["# Class LocationName (4.10.0)\n\nVersion latestkeyboard_arrow_down\n\n- [4.10.0 (latest)](/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.ResourceNames.LocationName)\n- [4.8.0](/dotnet/docs/reference/Google.Api.Gax/4.8.0/Google.Api.Gax.ResourceNames.LocationName)\n- [4.4.0](/dotnet/docs/reference/Google.Api.Gax/4.4.0/Google.Api.Gax.ResourceNames.LocationName)\n- [4.3.1](/dotnet/docs/reference/Google.Api.Gax/4.3.1/Google.Api.Gax.ResourceNames.LocationName)\n- [4.2.0](/dotnet/docs/reference/Google.Api.Gax/4.2.0/Google.Api.Gax.ResourceNames.LocationName)\n- [4.0.0](/dotnet/docs/reference/Google.Api.Gax/4.0.0/Google.Api.Gax.ResourceNames.LocationName)\n- [3.2.0](/dotnet/docs/reference/Google.Api.Gax/3.2.0/Google.Api.Gax.ResourceNames.LocationName) \n\n public sealed class LocationName : IResourceName, IEquatable\u003cLocationName\u003e\n\nResource name for the 'location' resource which is widespread across Google Cloud.\nWhile most resource names are generated on a per-API basis, many APIs use a location resource, and it's\nuseful to be able to pass values from one API to another. \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e LocationName \n\nImplements\n----------\n\n[IResourceName](/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.IResourceName), [IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[LocationName](/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.ResourceNames.LocationName) \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.Gax.ResourceNames](/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.ResourceNames)\n\nAssembly\n--------\n\nGoogle.Api.Gax.dll\n\nConstructors\n------------\n\n### LocationName(string, string)\n\n public LocationName(string projectId, string locationId)\n\nConstructs a new instance of a [LocationName](/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.ResourceNames.LocationName) class from the component parts of pattern\n`projects/{project}/locations/{location}`\n\nProperties\n----------\n\n### IsKnownPattern\n\n public bool IsKnownPattern { get; }\n\nWhether this instance contains a resource name with a known pattern.\n\n### LocationId\n\n public string LocationId { get; }\n\nThe `Location` ID. Will not be `null`, unless this instance contains an unparsed resource name.\n\n### ProjectId\n\n public string ProjectId { get; }\n\nThe `Project` ID. Will not be `null`, unless this instance contains an unparsed resource name.\n\n### Type\n\n public LocationName.ResourceNameType Type { get; }\n\nThe [LocationName.ResourceNameType](/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.ResourceNames.LocationName.ResourceNameType) of the contained resource name.\n\n### UnparsedResource\n\n public UnparsedResourceName UnparsedResource { get; }\n\nThe contained [UnparsedResourceName](/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.UnparsedResourceName). Only non-`null`if this instance contains an\nunparsed resource name.\n\nMethods\n-------\n\n### Equals(LocationName)\n\n public bool Equals(LocationName other)\n\n### Equals(object)\n\n public override bool Equals(object obj)\n\n**Overrides** \n[object.Equals(object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object))\n\n### Format(string, string)\n\n public static string Format(string projectId, string locationId)\n\nFormats the IDs into the string representation of this [LocationName](/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.ResourceNames.LocationName) with pattern\n`projects/{project}/locations/{location}`.\n\n### FormatProjectLocation(string, string)\n\n public static string FormatProjectLocation(string projectId, string locationId)\n\nFormats the IDs into the string representation of this [LocationName](/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.ResourceNames.LocationName) with pattern\n`projects/{project}/locations/{location}`.\n\n### FromProjectLocation(string, string)\n\n public static LocationName FromProjectLocation(string projectId, string locationId)\n\nCreates a [LocationName](/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.ResourceNames.LocationName) with the pattern `projects/{project}/locations/{location}`.\n\n### FromUnparsed(UnparsedResourceName)\n\n public static LocationName FromUnparsed(UnparsedResourceName unparsedResourceName)\n\nCreates a [LocationName](/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.ResourceNames.LocationName) containing an unparsed resource name.\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### Parse(string)\n\n public static LocationName Parse(string locationName)\n\nParses the given resource name string into a new [LocationName](/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.ResourceNames.LocationName) instance.\n\n**Remarks** \nTo parse successfully, the resource name must be formatted as one of the following:\n\n- `projects/{project}/locations/{location}`\n\n\u003cbr /\u003e\n\n### Parse(string, bool)\n\n public static LocationName Parse(string locationName, bool allowUnparsed)\n\nParses the given resource name string into a new [LocationName](/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.ResourceNames.LocationName) instance; optionally allowing an\nunparseable resource name.\n\n**Remarks** \nTo parse successfully, the resource name must be formatted as one of the following:\n\n- `projects/{project}/locations/{location}`\n\nOr may be in any format if `allowUnparsed` is `true`.\n\n\u003cbr /\u003e\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### TryParse(string, out LocationName)\n\n public static bool TryParse(string locationName, out LocationName result)\n\nTries to parse the given resource name string into a new [LocationName](/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.ResourceNames.LocationName) instance.\n\n**Remarks** \nTo parse successfully, the resource name must be formatted as one of the following:\n\n- `projects/{project}/locations/{location}`\n\n\u003cbr /\u003e\n\n### TryParse(string, bool, out LocationName)\n\n public static bool TryParse(string locationName, bool allowUnparsed, out LocationName result)\n\nTries to parse the given resource name string into a new [LocationName](/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.ResourceNames.LocationName) instance; optionally\nallowing an unparseable resource name.\n\n**Remarks** \nTo parse successfully, the resource name must be formatted as one of the following:\n\n- `projects/{project}/locations/{location}`\n\nOr may be in any format if `allowUnparsed` is `true`.\n\n\u003cbr /\u003e\n\nOperators\n---------\n\n### operator ==(LocationName, LocationName)\n\n public static bool operator ==(LocationName a, LocationName b)\n\n### operator !=(LocationName, LocationName)\n\n public static bool operator !=(LocationName a, LocationName b)"]]