diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/src/ResourceIdentifier/ResourceIdentifier.cs b/sdk/resourcemanager/Azure.ResourceManager.Core/src/ResourceIdentifier/ResourceIdentifier.cs index 82a9ff1800bd8..c14cf1ba9fff1 100644 --- a/sdk/resourcemanager/Azure.ResourceManager.Core/src/ResourceIdentifier/ResourceIdentifier.cs +++ b/sdk/resourcemanager/Azure.ResourceManager.Core/src/ResourceIdentifier/ResourceIdentifier.cs @@ -428,7 +428,7 @@ internal virtual string ToResourceString() StringBuilder builder = new StringBuilder(Parent.ToResourceString()); if (IsChild) { - builder.Append($"/{ResourceType.Types.Last()}"); + builder.Append($"/{ResourceType.Types[ResourceType.Types.Count - 1]}"); if (!string.IsNullOrWhiteSpace(Name)) builder.Append($"/{Name}"); } diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/src/ResourceIdentifier/ResourceType.cs b/sdk/resourcemanager/Azure.ResourceManager.Core/src/ResourceIdentifier/ResourceType.cs index 660389434aa4c..4dc59237380a4 100644 --- a/sdk/resourcemanager/Azure.ResourceManager.Core/src/ResourceIdentifier/ResourceType.cs +++ b/sdk/resourcemanager/Azure.ResourceManager.Core/src/ResourceIdentifier/ResourceType.cs @@ -63,7 +63,10 @@ internal ResourceType(ResourceType parent, string childType) /// public string Type { get; private set; } - internal IList Types { get; } = new List(); + /// + /// Gets the resource Types. + /// + public IReadOnlyList Types { get; } = new List(); /// /// Determines if this resource type is the parent of the given resource.