コード例 #1
0
        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));
        }
コード例 #2
0
 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);
 }
コード例 #3
0
 private PSTemplateSpecListItem(PSTemplateSpec templateSpec)
     : base(templateSpec)
 {
 }