2

I have a client using .net and I am using LINQBride with some existing code that uses LINQ. I don't really know much about linq but am wondering if there is a quick conversion using LINQBridge for this expression

DynamicMethod.CreateDelegate(Expression.GetFuncType(typeof(IDataReader), type));

Thanks

user204588
  • 1,613
  • 4
  • 31
  • 50

1 Answers1

2

LinqBridge only implements Linq to Objects, it doesn't support expressions. But you can achieve something similar using reflection:

static Type GetFuncType(params Type[] typeArgs)
{
    string typeName = "System.Func`" + typeArgs.Length;
    Type genericTypeDef = typeof(Func<>).Assembly.GetType(typeName); // Func<,...,>
    return genericTypeDef.MakeGenericType(typeArgs); // Func<TArg1, ..., TResult>
}
Thomas Levesque
  • 286,951
  • 70
  • 623
  • 758