예제 #1
0
 public static String GetCSharpTypeArgsClause(this MethodInfo mi)
 {
     Func<Type, IEnumerable<Type>> ogargs = t =>
         t.Flatten(t1 => t1.XGetGenericArguments()).Where(garg => garg.IsGenericParameter);
     var involvedTypes = mi.Args().Concat(mi.ReturnType).Concat(mi.DeclaringType);
     var m_ogargs = involvedTypes.SelectMany(ogargs).Distinct().ToArray();
     return GetCSharpTypeArgsClause(m_ogargs);
 }
예제 #2
0
 public static int Argc(this MethodInfo mi)
 {
     return mi.Args().Count();
 }
예제 #3
0
 public static Type ToFunc(this Type ftype, Func<IEnumerable<Type>, IEnumerable<Type>> xform, Type ret)
 {
     ftype.IsFType().AssertTrue();
     return xform(ftype.Args()).ToFunc(ret);
 }
예제 #4
0
 public static Type ToFunc(this Type ftype, Func<Type, bool> argFilter, Type ret)
 {
     ftype.IsFType().AssertTrue();
     return ftype.Args().Where(argFilter).ToFunc(ret);
 }
예제 #5
0
 public static String GetCSharpTypeConstraintsClause(this MethodInfo mi)
 {
     Func<Type, IEnumerable<Type>> ogargs = t =>
         t.Flatten(t1 => t1.XGetGenericArguments()).Where(garg => garg.IsGenericParameter);
     var m_ogargs = mi.Args().Concat(mi.ReturnType).SelectMany(ogargs).Distinct().ToArray();
     return m_ogargs.Select(ogarg => ogarg.GetCSharpTypeConstraintsClause()).StringJoin(Environment.NewLine);
 }