// 綁定Adaptive Card的資料 public static AdaptiveCard BindData(this AdaptiveCard card, JObject data) { if (data == null) { return(card); } return(card.BindData(data.ToObject <Dictionary <string, object> >())); }
// 綁定Adaptive Card的資料 public static AdaptiveCard BindData <T>(this AdaptiveCard card, T data) { if (data == null) { return(card); } var dictionaryData = data.GetType() .GetProperties(BindingFlags.Instance | BindingFlags.Public) .ToDictionary(prop => prop.Name, prop => prop.GetValue(data, null)); return(card.BindData(dictionaryData)); }