/// <summary> /// Get all specified fields from the given object, using the specified binding constraints. /// </summary> /// <param name="obj"></param> /// <param name="bindingAttr"></param> /// <returns></returns> public static FieldInfo[] GetFields(this object obj, BindingFlags bindingAttr) { ObjectGuard.NotNull(obj, nameof(obj)); return(obj.GetType().GetFields(bindingAttr)); }
/// <summary> /// Get all public fields from the given object. /// </summary> /// <param name="obj"></param> /// <returns></returns> public static FieldInfo[] GetFields(this object obj) { ObjectGuard.NotNull(obj, nameof(obj)); return(TypeReflections.TypeCacheManager.GetTypeFields(obj.GetType())); }