private IEnumerable <KeyValuePair <string, object> > GetPropertyValues(Type type, object obj, IEnumerable <string> filter = null) { IEnumerable <PropertyInfo> plist = type.GetCachedProperties(); if (filter != null) { plist = plist.Where(x => filter.Contains(x.Name)); } foreach (var item in plist) { yield return(new KeyValuePair <string, object>(item.Name, GenericMethods.GetProperty(obj, item))); } }