private UserGroup[] GetUserGroups() { switch (ParameterSetName) { case "FromUserGroup": return(UserGroup); case "FromSid": return(Sid.Select(s => new UserGroup(s, Attribute)).ToArray()); case "FromKnownSid": return(KnownSid.Select(s => new UserGroup(KnownSids.GetKnownSid(s), Attribute)).ToArray()); default: throw new ArgumentException("Invalid SID type."); } }