/// <summary> /// Initializes a new instance of the <see cref="ShowCommandParameterSetInfo"/> class /// with the specified <see cref="PSObject"/>. /// </summary> /// <param name="other"> /// The object to wrap. /// </param> public ShowCommandParameterSetInfo(PSObject other) { if (other == null) { throw new ArgumentNullException(nameof(other)); } this.Name = other.Members["Name"].Value as string; this.IsDefault = (bool)(other.Members["IsDefault"].Value); var parameters = (other.Members["Parameters"].Value as PSObject).BaseObject as System.Collections.ArrayList; this.Parameters = ShowCommandCommandInfo.GetObjectEnumerable(parameters).Cast <PSObject>().Select(x => new ShowCommandParameterInfo(x)).ToArray(); }
/// <summary> /// Initializes a new instance of the <see cref="ShowCommandParameterInfo"/> class. /// Creates an instance of the ShowCommandParameterInfo class based on a PSObject object. /// </summary> /// <param name="other"> /// The object to wrap. /// </param> public ShowCommandParameterInfo(PSObject other) { if (other == null) { throw new ArgumentNullException(nameof(other)); } this.Name = other.Members["Name"].Value as string; this.IsMandatory = (bool)(other.Members["IsMandatory"].Value); this.ValueFromPipeline = (bool)(other.Members["ValueFromPipeline"].Value); this.HasParameterSet = (bool)(other.Members["HasParameterSet"].Value); this.ParameterType = new ShowCommandParameterType(other.Members["ParameterType"].Value as PSObject); this.Position = (int)(other.Members["Position"].Value); if (this.HasParameterSet) { this.ValidParamSetValues = ShowCommandCommandInfo.GetObjectEnumerable((other.Members["ValidParamSetValues"].Value as PSObject).BaseObject as System.Collections.ArrayList).Cast <string>().ToList(); } }