コード例 #1
0
 public void UpdateParamSets()
 {
     if (ParameterSets == null)
     {
         return;
     }
     ParamSets.Clear();
     foreach (CommandParameterSetInfo paramInfo in ParameterSets)
     {
         CommandParameterSetInfo2 info = new CommandParameterSetInfo2 {
             Name = paramInfo.Name
         };
         foreach (var param in paramInfo.Parameters)
         {
             info.Parameters.Add(param.Name);
         }
         ParamSets.Add(info);
     }
 }
コード例 #2
0
 void getParameterSets(PSObject cmdlet)
 {
     ParameterSets = new List <CommandParameterSetInfo>();
     if (cmdlet.Members["ParameterSets"].Value != null)
     {
         ParameterSets = new List <CommandParameterSetInfo>((ReadOnlyCollection <CommandParameterSetInfo>)cmdlet.Members["ParameterSets"].Value);
         foreach (CommandParameterSetInfo paramInfo in ParameterSets)
         {
             CommandParameterSetInfo2 info = new CommandParameterSetInfo2 {
                 Name = paramInfo.Name
             };
             foreach (var param in paramInfo.Parameters)
             {
                 info.Parameters.Add(param.Name);
             }
             ParamSets.Add(info);
         }
     }
 }