Expression.Call is the way to go.
But still you would need to use semantic data to get associated reflection data such as Types and MethodInfo.
The way to go about it is:
- Get compilation object by calling
Compilation.Create(...)in other words: compile your program using Roslyn API
SemanticModelout of it by calling
- Get TypeInfo calling GetTypeInfo(expression)
So... to sum it up
- Is it possible to create something like a MethodCallExpression without knowing the types of the related expressions?
- Is there any way to create a LINQ query as a variable without having the data source (yet)?
- Dynamicaly changing the type of a parameter in an Expression without knowing the target type at code time
- Is it possible to turn an IEnumerable into an IOrderedEnumerable without using OrderBy?
- Is there something like LINQ for Java?
- How to count the number of code lines in a C# solution, without comments and empty lines, and other redundant stuff, etc?
- Is something in Swift like LINQ in C#
- Is it possible to express this code in LINQ?
- Is it possible to create C# language modifications as did LINQ?
- Why is my code doing lazy loading even after I turned it off at every possible point?
- Create all possible combinations of items in a list using Linq and C#
- Is it possible to create one dimension array from two using LINQ?
- Is it possible to use Linq and lambdas without including a System.Linq namespace?
- It is possible to create a generic search method where key is unknown
- .NET String parsing performance improvement - Possible Code Smell
- Is it possible to use Entity Framework without LINQ?
- How can I create a dynamic LINQ query in C# with possible multiple group by clauses?
- LINQ Source Code Available
- Is it possible to recreate this statement without using a foreach?
- Is it possible to use Linq-SQL without drag-and-drop?
- Is it possible to ignore a list item using the Skip method of the LINQ then apply skip on the list without losing that item?
- Entity Framework Code First without app.config
- .NET 4 Code Contracts: "requires unproven: source != null"
- Possible to ignore the Expression if it's null or empty without checking for null in an IF statement?
- Merge duplicate data without affecting others in LINQ code
- Linq2Sql: Can I create entities with foreign key relationships without a primary key in both tables?
- How to create a non-nullable CRM basic type like int or double?
- Is possible with LINQ to extract from an array of objects the value of one property and create a new array?
- LINQ Is it possible to get a method name without a return type via LINQ expression trees?
- Create LINQ Association without Foreign Keys
More Query from same tag
- How to get User Role for each user in Data access layer in Identity (MVC5)?
- C# sort dictionary with linq
- LINQ, simplifying expression - take while sum of taken does not exceed given value
- Can I use LINQ without Entity Framework?
- Linq to entities - One to many relationship - need left outer join instead of cross join
- Select one row per specific time
- LINQ to SQL how optimise query?
- EF Navigation Property with null foreign key
- Get the row in an excel.range where the Value is the same
- Sort a string property like Integer LINQ
- Slow foreach() on a LINQ query - ToList() boosts performance immensely - why is this?
- LINQ to Entities does not recognize the method 'System.Collections.Generic.Dictionary`2[System.Int32,System.String] ToDictionary
- Why does my Linq Where clause produce more results instead of less?
- Rewriting an SQL statement as a LINQ query results in runtime error
- DataLoadOptions equivalent for LINQ to Entities?
- How to get an Id (int) using Linq or Lambda based on condition in C#?
- LINQ - Joining 3 tables and selecting an item with two lists
- LINQ AsNoTracking running slow
- C# linq build table from sub list of list
- aggregation count in linq query returns null
- Needed to replace int with int array
- Add an existing xml element to a xml document
- Sorting a generic list by an external sort order
- How do i traverse through an xml document that has identical elements?
- programmatic where in clause for PredicateBuilder
- C# LINQ converting a query to dictionary
- Using LINQ to compare two sequences for differences
- Group by a many-to-many relashionship
- C# min from datatable row
- Return the same type for two views from datacontext