public static IEnumerable<PropertyInfo> GetPublicProperties(this Type type)
{
var instancePublic = new Func<PropertyInfo, bool>(
p => !p.GetMethod.IsStatic && p.GetMethod.IsPublic);
return type.IsInterface()
? (new Type[] { type })
.Concat(type.GetInterfaces())
.SelectMany(i => i.GetRuntimeProperties().Where(instancePublic))
: type.GetRuntimeProperties().Where(instancePublic);
}