/// <summary> /// Gets the CommandResultValue from the commmand result activity. /// </summary> /// <param name="activity">The command result activity.</param> /// <typeparam name="T">The underlying value type for the <see cref="CommandValue"/>.</typeparam> /// <returns>Gets the <see cref="CommandResultValue"/> from the activity.</returns> public static CommandResultValue <T> GetCommandResultValue <T>(this ICommandResultActivity activity) { object value = activity?.Value; if (value == null) { return(null); } else if (value is CommandResultValue <T> commandResultValue) { return(commandResultValue); } else { return(((JObject)value).ToObject <CommandResultValue <T> >()); } }
public static CommandResultValue <object> GetCommandResultValue(this ICommandResultActivity activity) { return(GetCommandResultValue <object>(activity)); }