What is an expression tree in C#?
An expression tree represents code as a tree-like data structure rather than immediately compiling it into executable instructions.
C# interview questions covering advanced linq, expressions & collections.
Open a question for the full answer, code and interview guidance.
An expression tree represents code as a tree-like data structure rather than immediately compiling it into executable instructions.
Func<T,bool> is a compiled delegate that can execute C# logic directly. Expression<Func<T,bool>> is a data structure representing the lambda expression.
ToList() immediately enumerates a sequence and stores the results in a List<T>. ToArray() also materializes immediately but stores the results in an array.
Materialization is the process of executing a query and creating in-memory objects from its results.
HashSet<T> is a generic collection that stores unique values and provides efficient membership checks.
Dictionary<TKey,TValue> is a general-purpose key-value collection and is not designed for unsynchronized concurrent writes.
IComparer<T> defines custom ordering logic through the Compare method. It is useful when objects need to be sorted using a rule that is separate from the object's natural ordering.
IEqualityComparer<T> defines custom equality and hash-code logic for a type without changing the type itself.
Immutable collections create a new collection when a change is requested rather than modifying the existing instance.
IEnumerable<T> guarantees only that a sequence can be enumerated.