Represents an initializer for a single element of an IEnumerable collection.
Assembly: System.Core (in System.Core.dll)
Determines whether the specified object is equal to the current object.(Inherited from Object.)
Serves as the default hash function. (Inherited from Object.)
Returns a textual representation of an Object.ToString().)object.(Overrides
Creates a new expression that is like this one, but using the supplied children. If all of the children are the same, it will return this expression.
Returns the argument at index, throwing if index is out of bounds. You should not use this member. It is only public due to assembly refactoring, and it is used internally for performance optimizations.
Returns the number of arguments to the expression tree node. You should not use this member. It is only public due to assembly refactoring, and it is used internally for performance optimizations.
The following example creates anthat represents the initialization of an element of a dictionary collection.
string tree = "maple"; System.Reflection.MethodInfo addMethod = typeof(Dictionary<int, string>).GetMethod("Add"); // Create an ElementInit that represents calling // Dictionary<int, string>.Add(tree.Length, tree). System.Linq.Expressions.ElementInit elementInit = System.Linq.Expressions.Expression.ElementInit( addMethod, System.Linq.Expressions.Expression.Constant(tree.Length), System.Linq.Expressions.Expression.Constant(tree)); Console.WriteLine(elementInit.ToString()); // This code produces the following output: // // Void Add(Int32, System.String)(5,"maple")
Available since 8
Available since 3.5
Portable Class Library
Supported in: portable .NET platforms
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Available since 8.1
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.