DbExpressionBuilder.NewCollection Method
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.
Assembly: EntityFramework (in EntityFramework.dll)
Name | Description | |
---|---|---|
![]() ![]() | NewCollection(DbExpression[]) | 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. |
![]() ![]() | NewCollection(IEnumerable<DbExpression>) | 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. |
DbExpressionBuilder.NewCollection Method (DbExpression[])
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.
Parameters
- elements
-
Type:
System.Data.Entity.Core.Common.CommandTrees.DbExpression[]
A list of expressions that provide the elements of the collection.
Return Value
Type: System.Data.Entity.Core.Common.CommandTrees.DbNewInstanceExpressionA new DbNewInstanceExpression with the specified collection type and arguments.
Exception | Condition |
---|---|
ArgumentNullException | elements is null, or contains null. |
ArgumentException | elements is empty or contains expressions for which no common result type exists. |
DbExpressionBuilder.NewCollection Method (IEnumerable<DbExpression>)
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.
Parameters
- elements
-
Type:
System.Collections.Generic.IEnumerable<DbExpression>
A list of expressions that provide the elements of the collection.
Return Value
Type: System.Data.Entity.Core.Common.CommandTrees.DbNewInstanceExpressionA new DbNewInstanceExpression with the specified collection type and arguments.
Exception | Condition |
---|---|
ArgumentNullException | elements is null, or contains null. |
ArgumentException | elements is empty or contains expressions for which no common result type exists. |