using System; namespace OpenSEMI.ClientBase.Command { public class CommandParameter { public TCustomParameter CustomParameter { get; private set; } protected CommandParameter(TCustomParameter customParameter) { CustomParameter = customParameter; } public static CommandParameter Cast(object parameter) { CommandParameter commandParameter = parameter as CommandParameter; if (commandParameter == null) { throw new InvalidCastException($"Failed to case {parameter.GetType()} to {typeof(CommandParameter)}"); } return new CommandParameter((TCustomParameter)commandParameter.CustomParameter); } } }