Skip to main content
The 2026 Annual Developer Survey is live— take the Survey today!
Filter by
Sorted by
Tagged with
Filter by Employee ID
Score of 0
1 answer
139 views

Let's have 3 entities with the same base class for ID's: public class EntityBase { public int Id { get; set; } } public class Company : EntityBase { public string Brand { get; set; } public ...
Score of 8
1 answer
294 views

I'm experimenting with C# Expression Trees and trying to understand the difference between Expression.Return and Expression.Goto. I can’t create an example where Return and Goto behave differently ...
Score of 2
2 answers
260 views

I have a code snippet that uses let with a where clause. private List<string> Example2() { var query1 = from c in _context.Customers let custPurchases = _context.Purchases....
Score of 0
1 answer
347 views

I have a filter string conformant to the OData $filter syntax and wish to parse it into a System.Linq.Expressions expression. Context: The web API of our cloud application offers querying endpoints ...
Score of 1
1 answer
96 views

A rather complicated object mapping I've inherited uses static Expression<Func<...>> in the .Select call (from my research these seem to be called "Expression Trees", but for ...
Score of -1
1 answer
95 views

I am trying to have MethodCallExpression compiled with a lambda expression. Basically i want a method to be called everytime the lambda expression is invoked. I am not sure i'm even on the right path ...
Score of 0
1 answer
93 views

PROBLEM TO SOLVE I'm trying to create a mock of interface ISomeService using Moq library which will wrap its real implementation SomeService. Right now I'm doing this manually like this: var instance =...
Score of 3
1 answer
83 views

I'm trying to convert a method to an expression tree for a test, but I got an error Exception thrown: 'System.ArgumentException' in System.Linq.Expressions.dll Expression of type 'System.Void' cannot ...
Score of 0
0 answers
79 views

I am trying to build a Dictionary(Of Type, Func(Of ServiceModel.EndpointAddress)). The func represents a method which takes in a single string parameter which is the service url and returns a ...
Score of 2
2 answers
108 views

I want to subscribe to any event existing on a given object, where I don't know the type in advance. I'm generatig event handler at run-time using System.Linq.Expressions.Expression. The code I have (...
Score of 0
2 answers
154 views

I struggle with adding ToLower() to the Contains LINQ Expressions: Here is the code of mine with dynamic LINQ Expressions (Contains): private static Expression GetExpressionCase<T>(...
Score of 1
1 answer
94 views

I have such query in NH Linq: var query = _session .Query<Revision>() .Join( _session.Query<Document>(), rev => rev.Document, doc => doc, (rev,...
Score of 1
2 answers
181 views

This compiled expression tree... var param = Expression.Parameter(typeof(int)); var innerParam = Expression.Parameter(typeof(Action<int>)); var inner = Expression.Lambda(innerParam.Type, ...
Score of 3
2 answers
161 views

I have found little issue with expression trees and would like to know whether such is a bug or a feature. I have this code. The first function assigns one to a variable and returns it. static class ...
Score of 0
0 answers
80 views

I am attempting to build a lambda from data. The module entity has an AlgNo property of type string. I am trying to get a simple sample code to run before attempting the more advanced case. Consider ...

15 30 50 per page
1
2 3 4 5
142