/// <summary> /// Creates an instance of the ShowCommandParameterSetInfo class based on a PSObject object /// </summary> /// /// <param name="other"> /// The object to wrap. /// </param> public ShowCommandParameterSetInfo(PSObject other) { if (null == other) { throw new ArgumentNullException("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> /// 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 (null == other) { throw new ArgumentNullException("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(); } }