score:2
Accepted answer
Your problem has nothing to do with expression trees (which would be easier to spot if you bothered to include the error you're getting).
You have Option Infer Off
and Option Strict Off
and the following code:
Dim getter = getterLambda.Compile()
Return getter()
which throws MissingMemberException
:
No default member found for type 'Func(Of Object)'.
The problem is that ()
is here interpreted as invoking the default member and not invoking a delegate, because getter
is typed as Object
. To work around that, you can specify the type of the variable:
Dim getter As Func(Of Object) = getterLambda.Compile()
Return getter()
or you can use more verbose syntax for invoking a delegate:
Dim getter = getterLambda.Compile()
Return getter.Invoke()
Source: stackoverflow.com
Related Query
- How to reuse a linq expression for 'Where' when using multiple source tables
- LINQ Source Code Available
- creating Linq to sqlite dbml from DbLinq source code
- Linq to Sql: Optimizing lamba expression - clean code
- Unreachable expression code in LINQ query
- source code for LINQ 101 samples
- Linq Expression Refactor Duplicate Code
- optimise code into linq expression
- A LINQ question: map query expression to c# code
- Convert this linq code to expression
- how to translate a linq expression into sql string use c# code
- c# Linq or code to extract groups from a single list of source data
- Saved projection expression for re-use in different linq expressions with two source objects
- EF5 code first datetime2, building a linq expression
- Convert string[] to int[] in one line of code using LINQ
- Code equivalent to the 'let' keyword in chained LINQ extension method calls
- String.IsNullOrWhiteSpace in LINQ Expression
- How to flatten nested objects with linq expression
- LINQ to Entities does not recognize the method 'System.String ToString()' method, and this method cannot be translated into a store expression
- Linq code to select one item
- "Or" equivalent in Linq Where() lambda expression
- "The LINQ expression node type 'Invoke' is not supported in LINQ to Entities" - stumped!
- Error: "The specified LINQ expression contains references to queries that are associated with different contexts"
- The LINQ expression node type 'ArrayIndex' is not supported in LINQ to Entities
- How are people unit testing code that uses Linq to SQL
- Basic LINQ expression for an ItemCollection
- LINQ group by expression syntax
- How to create LINQ Expression Tree to select an anonymous type
- LINQ - Does the Where expression return new instance or reference to object instance
- Like in Lambda Expression and LINQ
More Query from same tag
- Linq with optional Where clauses and Sql Server CE
- How can I compare two IEnumerable<> objects and return a new one?
- LINQ anonymous object is inaccessible due to its protection level
- WebAPI Get() method to return list of all records matching criteria
- Why cannot use iterator block with IOrderedEnumerable
- Selecting items in an ordered list after a certain entry
- C#: Check particular attribute key-value pair is present using linq
- How to convert a LINQ query to use lambda expressions
- How to convert a file loop into LINQ?
- OrderBy list LINQ Query
- Linq query select property list with join
- Is there any LINQ like implementation in java?
- Issue when casting from DB
- Find element in a list that is contained in another class sub-list
- Adding varying values to a list inside of a Concurrent Dictionary
- Linq query to fill complex model?
- Possible bug in RavenDB EmbeddableDocumentStore
- Cannot convert IQueryable<Grouping> to IQueryable<Model>
- get the most recent updated record for each ID in the given list of IDs. LINQ
- not getting output in group by using linq query
- changing sql JOIN Syntax to LINQ
- Additional conditions to join
- Linq wherein extension methods variable p errors
- Select distinct DateTime properties from List<IDictionary<string,object>> using LINQ
- SubSonic 3 Linq projecting anonymous types but not class types
- C# Linq Char arrays Except() - Weird behavior
- How to pass variable list in ViewBag
- Using LINQ, where one object property has a value of x, how do I return the value in a different property
- Can't get IEnumerable type using linq filtered query
- Linq SQL to filter columns