Ejemplo n.º 1
0
 public static Assembly AssemblyByName(string name)
 => Safe.Run(() => Assembly.Load(name), null);
Ejemplo n.º 2
0
 public static List <Type> TypesForAssembly(string assemblyName) =>
 Safe.Run(() => {
     var a = AssemblyByName(assemblyName);
     return(a.GetTypes().ToList());
 }, new List <Type>());
Ejemplo n.º 3
0
        public static PropertyInfo Property <T>(Expression <Func <T, object> > ex)
        {
            var name = GetMember.Name(ex);

            return(Safe.Run(() => typeof(T).GetProperty(name), null));
        }
Ejemplo n.º 4
0
 public static PropertyInfo Property <T>(string name)
 => Safe.Run(() => typeof(T).GetProperty(name), null);
Ejemplo n.º 5
0
 public static int Count(Type type) => Safe.Run(()
                                                => Enum.GetValues(type).Length, -1);
Ejemplo n.º 6
0
 public static T Value <T>(int i) => Safe.Run(()
                                              => (T)Value(typeof(T), i), default(T));
Ejemplo n.º 7
0
 public static object Value(Type type, int i) =>
 Safe.Run(() => {
     var v = Enum.GetValues(type);
     return(v.GetValue(i));
 }, null);