Show / Hide Table of Contents

Class TemplatedResourceName

Class for representing and working with resource names.

Inheritance
System.Object
TemplatedResourceName
Implements
IResourceName
System.IEquatable<TemplatedResourceName>
Inherited Members
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Google.Api.Gax
Assembly: Google.Api.Gax.dll
Syntax
public sealed class TemplatedResourceName : IResourceName, IEquatable<TemplatedResourceName>
Remarks

A resource name is represented by a PathTemplate, an assignment of resource IDs to parameters in the template, and an optional service name. This class allows the service name and resource IDs to be modified, but only within the same template.

Constructors

TemplatedResourceName(PathTemplate, String[])

Creates a resource name with the given template and resource IDs. The resource IDs are cloned, so later changes to resourceIds are ignored. This constructor does not populate the ServiceName property, but that can be set after construction.

Declaration
public TemplatedResourceName(PathTemplate template, params string[] resourceIds)
Parameters
Type Name Description
PathTemplate template

The template for the new resource name. Must not be null.

System.String[] resourceIds

The resource IDs to populate template parameters with. Must not be null.

Properties

Item[Int32]

Gets or sets the identifier for the specified parameter index.

Declaration
public string this[int index] { get; set; }
Parameters
Type Name Description
System.Int32 index

The index of the parameter value to retrieve.

Property Value
Type Description
System.String

The identifier within the resource name at the given parameter index.

Item[String]

Gets or sets the identifier for the specified parameter name.

Declaration
public string this[string parameterName] { get; set; }
Parameters
Type Name Description
System.String parameterName

The name of the parameter value to retrieve.

Property Value
Type Description
System.String

The identifier within the resource name with the given parameter name.

Kind

The kind of resource name.

Declaration
public ResourceNameKind Kind { get; }
Property Value
Type Description
ResourceNameKind
Implements
IResourceName.Kind

ServiceName

The service name part of this resource name, or null if no service name is specified.

Declaration
public string ServiceName { get; set; }
Property Value
Type Description
System.String

Template

The template this resource name is associated with. Never null.

Declaration
public PathTemplate Template { get; }
Property Value
Type Description
PathTemplate

Methods

Clone()

Creates a clone of this resource name, which is then independent of the original.

Declaration
public TemplatedResourceName Clone()
Returns
Type Description
TemplatedResourceName

A clone of this resource name.

Equals(TemplatedResourceName)

Declaration
public bool Equals(TemplatedResourceName other)
Parameters
Type Name Description
TemplatedResourceName other
Returns
Type Description
System.Boolean
Implements
System.IEquatable<T>.Equals(T)

Equals(Object)

Declaration
public override bool Equals(object obj)
Parameters
Type Name Description
System.Object obj
Returns
Type Description
System.Boolean
Overrides
System.Object.Equals(System.Object)

GetHashCode()

Declaration
public override int GetHashCode()
Returns
Type Description
System.Int32
Overrides
System.Object.GetHashCode()

ToString()

Returns a string representation of this resource name, expanding the template parameters with the resource IDs and prepending the service name (if present).

Declaration
public override string ToString()
Returns
Type Description
System.String

A string representation of this resource name.

Overrides
System.Object.ToString()
Implements
IResourceName.ToString()

Operators

Equality(TemplatedResourceName, TemplatedResourceName)

Declaration
public static bool operator ==(TemplatedResourceName a, TemplatedResourceName b)
Parameters
Type Name Description
TemplatedResourceName a
TemplatedResourceName b
Returns
Type Description
System.Boolean

Inequality(TemplatedResourceName, TemplatedResourceName)

Declaration
public static bool operator !=(TemplatedResourceName a, TemplatedResourceName b)
Parameters
Type Name Description
TemplatedResourceName a
TemplatedResourceName b
Returns
Type Description
System.Boolean
Back to top