1 2 3 4 5 6 |
public static bool IsPropertyExist(dynamic data, string propertyname) { if (data is ExpandoObject) return ((IDictionary<string, object>)data).ContainsKey(propertyname); return data.GetType().GetProperty(propertyname) != null; } |