Beispiel #1
0
 private static M Choose(OneArgCtor ctor, C converters, object model)
 {
     if (ctor.NoArgs)
     {
         return new[] { Tuple.Create(ctor.Invoke(null), model) }
     }
     ;
     if (ctor.ArgType.IsInstanceOfType(model))
     {
         return new[] { Tuple.Create(ctor.Invoke(model), model) }
     }
     ;
     return(converters[ctor.ArgType](model)
            .Select(m => Tuple.Create(ctor.Invoke(m), m)));
 }
Beispiel #2
0
 public static OneArgCtor Ctor(this Type tp) => OneArgCtor.From(tp);