示例#1
0
 public static IEnumerable <TTo> Convert <TFrom, TTo>(IEnumerable <TFrom> list,
                                                      Func <TFrom, TTo> func)
 {
     return(Safe.Run(() => list.Select(func), new List <TTo>(), true));
 }
示例#2
0
 public static IEnumerable <T> OrderBy <T>(IEnumerable <T> list, Func <T, string> func)
 {
     return(Safe.Run(() => list.OrderBy(func), new List <T>() as IEnumerable <T>, true));
 }
示例#3
0
 public static RegionInfo ToRegionInfo(CultureInfo info)
 {
     return(info is null ? null : Safe.Run(() => new RegionInfo(info.LCID), null));
 }
示例#4
0
 public static IEnumerable <T> Distinct <T>(IEnumerable <T> list)
 {
     return(Safe.Run(list.Distinct, new List <T>(), true));
 }
示例#5
0
 public static Assembly AssemblyByName(string name)
 {
     return(Safe.Run(() => Assembly.Load(name), null));
 }
示例#6
0
 public static CultureInfo[] GetCultures(CultureTypes types)
 {
     return(Safe.Run(() => CultureInfo.GetCultures(types), new CultureInfo[0]));
 }
示例#7
0
 public static string Name <T>(Expression <Action <T> > ex)
 {
     return(Safe.Run(() => name(ex.Body), string.Empty));
 }
示例#8
0
 public static string Name <T>(Expression <Func <T, object> > ex)
 {
     return(Safe.Run(() => name(ex.Body), string.Empty));
 }
 public static List <PropertyInfo> Properties(Type type, BindingFlags f = GetPublic.All)
 {
     return(Safe.Run(() => type.GetProperties(f).ToList(), new List <PropertyInfo>()));
 }
示例#10
0
 public static bool IsCountry(RegionInfo r)
 {
     return(Safe.Run(() => SystemString.StartsWithLetter(r.ThreeLetterISORegionName), false));
 }
示例#11
0
 public static PropertyInfo Property <T>(string name)
 {
     return(Safe.Run(() => typeof(T).GetProperty(name), null));
 }
示例#12
0
文件: GetEnum.cs 项目: alpull/ITB1702
 public static int Count(Type type)
 {
     return(Safe.Run(() => Enum.GetValues(type).Length, -1));
 }
示例#13
0
文件: GetEnum.cs 项目: alpull/ITB1702
 public static T Value <T>(int i)
 {
     return(Safe.Run(() => (T)Value(typeof(T), i), default(T)));
 }