public static PSTemplateSpecListItem FromTemplateSpec( PSTemplateSpec templateSpec) { if (templateSpec.GetType() != typeof(PSTemplateSpec)) { throw new InvalidOperationException( $"{nameof(PSTemplateSpecListItem)}s cannot be created from subclasses of {nameof(PSTemplateSpec)}" ); } return(new PSTemplateSpecListItem(templateSpec)); }
protected PSTemplateSpec(PSTemplateSpec toCopyFrom) { this.Id = toCopyFrom.Id; this.Type = toCopyFrom.Type; this.Name = toCopyFrom.Name; this.Location = toCopyFrom.Location; this.CreationTime = toCopyFrom.CreationTime; this.LastModifiedTime = toCopyFrom.LastModifiedTime; this.Description = toCopyFrom.Description; this.DisplayName = toCopyFrom.DisplayName; this.Versions = toCopyFrom.Versions?.ToArray(); // Shallow copy this.Tags = toCopyFrom.Tags == null ? null : new Dictionary <string, string>(toCopyFrom.Tags); }
private PSTemplateSpecListItem(PSTemplateSpec templateSpec) : base(templateSpec) { }