1 using System.Collections.Generic;
2 using System.Reflection;
4 namespace Hammock.Extensions
6 internal static class ReflectionExtensions
8 public static IEnumerable<T> GetCustomAttributes<T>(this PropertyInfo info, bool inherit)
11 var attributes = info.GetCustomAttributes(typeof (T), inherit);
12 return attributes.ToEnumerable<T>();
15 public static object GetValue(this object instance, string property)
17 var info = instance.GetType().GetProperty(property);
20 var value = info.GetValue(instance, null);
26 public static void SetValue(this object instance, string property, object value)
28 var info = instance.GetType().GetProperty(property);
29 info.SetValue(instance, value, null);