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\u003eThis document provides reference documentation for the \u003ccode\u003eUserName\u003c/code\u003e class within the \u003ccode\u003eGoogle.Cloud.OsLogin.Common\u003c/code\u003e namespace, which is a resource name for a \u003ccode\u003eUser\u003c/code\u003e resource.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eUserName\u003c/code\u003e class is used to handle resource names with the pattern \u003ccode\u003eusers/{user}\u003c/code\u003e, implementing interfaces like \u003ccode\u003eIResourceName\u003c/code\u003e and \u003ccode\u003eIEquatable<UserName>\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eIt provides constructors, properties (like \u003ccode\u003eIsKnownPattern\u003c/code\u003e, \u003ccode\u003eType\u003c/code\u003e, \u003ccode\u003eUnparsedResource\u003c/code\u003e, and \u003ccode\u003eUserId\u003c/code\u003e), and methods for formatting, parsing, and managing user IDs, as well as handling unparsed resource names.\u003c/p\u003e\n"],["\u003cp\u003eThe class offers static methods such as \u003ccode\u003eFormat\u003c/code\u003e, \u003ccode\u003eFormatUser\u003c/code\u003e, \u003ccode\u003eFromUnparsed\u003c/code\u003e, \u003ccode\u003eFromUser\u003c/code\u003e, \u003ccode\u003eParse\u003c/code\u003e, and \u003ccode\u003eTryParse\u003c/code\u003e to interact with the \u003ccode\u003eUserName\u003c/code\u003e instances, including parsing from string representations and creating instances from user IDs or unparsed names.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eUserName\u003c/code\u003e class supports equality comparison using \u003ccode\u003eoperator ==\u003c/code\u003e and \u003ccode\u003eoperator !=\u003c/code\u003e to check if two resource names have the same or different values.\u003c/p\u003e\n"]]],[],null,["# Google.Cloud.OsLogin.Common - Class UserName (3.3.0)\n\nVersion latestkeyboard_arrow_down\n\n- [3.3.0 (latest)](/dotnet/docs/reference/Google.Cloud.OsLogin.Common/latest/Google.Cloud.OsLogin.Common.UserName)\n- [3.2.0](/dotnet/docs/reference/Google.Cloud.OsLogin.Common/3.2.0/Google.Cloud.OsLogin.Common.UserName)\n- [3.1.0](/dotnet/docs/reference/Google.Cloud.OsLogin.Common/3.1.0/Google.Cloud.OsLogin.Common.UserName)\n- [3.0.0](/dotnet/docs/reference/Google.Cloud.OsLogin.Common/3.0.0/Google.Cloud.OsLogin.Common.UserName)\n- [2.3.0](/dotnet/docs/reference/Google.Cloud.OsLogin.Common/2.3.0/Google.Cloud.OsLogin.Common.UserName)\n- [2.2.0](/dotnet/docs/reference/Google.Cloud.OsLogin.Common/2.2.0/Google.Cloud.OsLogin.Common.UserName) \n\n public sealed class UserName : IResourceName, IEquatable\u003cUserName\u003e\n\nReference documentation and code samples for the Google.Cloud.OsLogin.Common class UserName.\n\nResource name for the `User` resource. \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e UserName \n\nImplements\n----------\n\n[IResourceName](https://github.com/googleapis/gax-dotnet/blob/83f42b5edc4529818dbdb34d9ea9ecc3c04f7b6e/Google.Api.Gax/IResourceName.cs), [IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[UserName](/dotnet/docs/reference/Google.Cloud.OsLogin.Common/latest/Google.Cloud.OsLogin.Common.UserName) \n\nInherited Members\n-----------------\n\n[object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype)\n\nNamespace\n---------\n\n[Google.Cloud.OsLogin.Common](/dotnet/docs/reference/Google.Cloud.OsLogin.Common/latest/Google.Cloud.OsLogin.Common)\n\nAssembly\n--------\n\nGoogle.Cloud.OsLogin.Common.dll\n\nConstructors\n------------\n\n### UserName(string)\n\n public UserName(string userId)\n\nConstructs a new instance of a [UserName](/dotnet/docs/reference/Google.Cloud.OsLogin.Common/latest/Google.Cloud.OsLogin.Common.UserName) class from the component parts of pattern\n`users/{user}`\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### Type\n\n public UserName.ResourceNameType Type { get; }\n\nThe [UserName.ResourceNameType](/dotnet/docs/reference/Google.Cloud.OsLogin.Common/latest/Google.Cloud.OsLogin.Common.UserName.ResourceNameType) of the contained resource name.\n\n### UnparsedResource\n\n public UnparsedResourceName UnparsedResource { get; }\n\nThe contained [UnparsedResourceName](https://github.com/googleapis/gax-dotnet/blob/83f42b5edc4529818dbdb34d9ea9ecc3c04f7b6e/Google.Api.Gax/UnparsedResourceName.cs). Only non-`null` if this instance contains an\nunparsed resource name.\n\n### UserId\n\n public string UserId { get; }\n\nThe `User` ID. Will not be `null`, unless this instance contains an unparsed resource name.\n\nMethods\n-------\n\n### Format(string)\n\n public static string Format(string userId)\n\nFormats the IDs into the string representation of this [UserName](/dotnet/docs/reference/Google.Cloud.OsLogin.Common/latest/Google.Cloud.OsLogin.Common.UserName) with pattern `users/{user}`\n.\n\n### FormatUser(string)\n\n public static string FormatUser(string userId)\n\nFormats the IDs into the string representation of this [UserName](/dotnet/docs/reference/Google.Cloud.OsLogin.Common/latest/Google.Cloud.OsLogin.Common.UserName) with pattern `users/{user}`\n.\n\n### FromUnparsed(UnparsedResourceName)\n\n public static UserName FromUnparsed(UnparsedResourceName unparsedResourceName)\n\nCreates a [UserName](/dotnet/docs/reference/Google.Cloud.OsLogin.Common/latest/Google.Cloud.OsLogin.Common.UserName) containing an unparsed resource name.\n\n### FromUser(string)\n\n public static UserName FromUser(string userId)\n\nCreates a [UserName](/dotnet/docs/reference/Google.Cloud.OsLogin.Common/latest/Google.Cloud.OsLogin.Common.UserName) with the pattern `users/{user}`.\n\n### GetHashCode()\n\n public override int GetHashCode()\n\nReturns a hash code for this resource name.\n\n**Overrides** \n[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode)\n\n### Parse(string)\n\n public static UserName Parse(string userName)\n\nParses the given resource name string into a new [UserName](/dotnet/docs/reference/Google.Cloud.OsLogin.Common/latest/Google.Cloud.OsLogin.Common.UserName) instance.\n\n**Remarks** \nTo parse successfully, the resource name must be formatted as one of the following:\n\n- `users/{user}`\n\n\u003cbr /\u003e\n\n### Parse(string, bool)\n\n public static UserName Parse(string userName, bool allowUnparsed)\n\nParses the given resource name string into a new [UserName](/dotnet/docs/reference/Google.Cloud.OsLogin.Common/latest/Google.Cloud.OsLogin.Common.UserName) 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- `users/{user}`\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\nThe string representation of the resource name.\n\n**Overrides** \n[object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)\n\n### TryParse(string, out UserName)\n\n public static bool TryParse(string userName, out UserName result)\n\nTries to parse the given resource name string into a new [UserName](/dotnet/docs/reference/Google.Cloud.OsLogin.Common/latest/Google.Cloud.OsLogin.Common.UserName) instance.\n\n**Remarks** \nTo parse successfully, the resource name must be formatted as one of the following:\n\n- `users/{user}`\n\n\u003cbr /\u003e\n\n### TryParse(string, bool, out UserName)\n\n public static bool TryParse(string userName, bool allowUnparsed, out UserName result)\n\nTries to parse the given resource name string into a new [UserName](/dotnet/docs/reference/Google.Cloud.OsLogin.Common/latest/Google.Cloud.OsLogin.Common.UserName) 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- `users/{user}`\n\nOr may be in any format if `allowUnparsed` is `true`.\n\n\u003cbr /\u003e\n\nOperators\n---------\n\n### operator ==(UserName, UserName)\n\n public static bool operator ==(UserName a, UserName b)\n\nDetermines whether two specified resource names have the same value.\n\n### operator !=(UserName, UserName)\n\n public static bool operator !=(UserName a, UserName b)\n\nDetermines whether two specified resource names have different values."]]