public static PlainCommand GetPlainCommand(this ObservableObject payLoad, CommandContainer commandContainer, string commandName) { string functionName = $"Can{commandName}"; functionName = functionName.Replace("Async", ""); MethodInfo?method = payLoad.GetPrivateMethod(commandName); if (method == null) { Type type = payLoad.GetType(); throw new BasicBlankException($"Method with the name of {commandName} was not found Type was {type.Name}"); } MethodInfo? fun = payLoad.GetPrivateMethod(functionName); PlainCommand output; if (fun != null) { output = new PlainCommand(payLoad, method, canExecuteM: fun, commandContainer); } else { PropertyInfo?pp = payLoad.GetPrivateProperty(functionName); output = new PlainCommand(payLoad, method, canExecute: pp, commandContainer); } return(output); }