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); }
public static int Argc(this MethodInfo mi) { return mi.Args().Count(); }
public static Type ToFunc(this Type ftype, Func<IEnumerable<Type>, IEnumerable<Type>> xform, Type ret) { ftype.IsFType().AssertTrue(); return xform(ftype.Args()).ToFunc(ret); }
public static Type ToFunc(this Type ftype, Func<Type, bool> argFilter, Type ret) { ftype.IsFType().AssertTrue(); return ftype.Args().Where(argFilter).ToFunc(ret); }
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); }