DbExpressionBuilder.NewCollection Method (IEnumerable<DbExpression>)

.NET Framework (current version)

Creates a new DbNewInstanceExpression that constructs a collection containing the specified elements. The type of the collection is based on the common type of the elements. If no common element type exists an exception is thrown.

Namespace:   System.Data.Common.CommandTrees.ExpressionBuilder
Assembly:  System.Data.Entity (in System.Data.Entity.dll)

public static DbNewInstanceExpression NewCollection(
	IEnumerable<DbExpression> elements


Type: System.Collections.Generic.IEnumerable<DbExpression>

A list of expressions that provide the elements of the collection.

Return Value

Type: System.Data.Common.CommandTrees.DbNewInstanceExpression

A new DbNewInstanceExpression with the specified collection type and arguments.

Exception Condition

elements is null, or contains null.


elements is empty or contains expressions for which no common result type exists.

.NET Framework
Available since 4.5
Return to top