/// <summary> /// Creates a resource name with the given template and resource IDs. /// The resource IDs are cloned, so later changes to <paramref name="resourceIds"/> /// are ignored. This constructor does not populate the <see cref="ServiceName"/> property, /// but that can be set after construction. /// </summary> /// <param name="template">The template for the new resource name. Must not be null.</param> /// <param name="resourceIds">The resource IDs to populate template parameters with. Must not be null.</param> public TemplatedResourceName(PathTemplate template, params string[] resourceIds) { Template = GaxPreconditions.CheckNotNull(template, nameof(Template)); GaxPreconditions.CheckNotNull(resourceIds, nameof(resourceIds)); // This is a somewhat annoying defensive copy. Given that we're usually going to just call ToString() // on the ResourceName, we don't really need the cloned array, or even the ResourceName itself. _resourceIds = (string[])resourceIds.Clone(); template.ValidateResourceIds(_resourceIds); }
/// <summary> /// Creates a resource name with the given template and resource IDs. /// The resource IDs are cloned, so later changes to <paramref name="resourceIds"/> /// are ignored. This constructor does not populate the <see cref="ServiceName"/> property, /// but that can be set after construction. /// </summary> /// <param name="template">The template for the new resource name. Must not be null.</param> /// <param name="resourceIds">The resource IDs to populate template parameters with. Must not be null.</param> public ResourceName(PathTemplate template, params string[] resourceIds) { Template = GaxPreconditions.CheckNotNull(template, nameof(Template)); GaxPreconditions.CheckNotNull(resourceIds, nameof(resourceIds)); // This is a somewhat annoying defensive copy. Given that we're usually going to just call ToString() // on the ResourceName, we don't really need the cloned array, or even the ResourceName itself. _resourceIds = (string[]) resourceIds.Clone(); template.ValidateResourceIds(_resourceIds); }