DbExpressionBuilder.NewCollection 方法 (DbExpression[])
[本页针对的是实体框架版本 6。最新版本以“实体框架”NuGet 包的形式提供。有关实体框架的更多信息,请参见 msdn.com/data/ef。]
创建一个新的 DbNewInstanceExpression,它构造一个包含指定元素的集合。 集合的类型基于元素的通用类型。 如果不存在通用元素类型,将引发异常。
命名空间: System.Data.Entity.Core.Common.CommandTrees.ExpressionBuilder
程序集: EntityFramework(在 EntityFramework.dll 中)
语法
声明
Public Shared Function NewCollection ( _
ParamArray elements As DbExpression() _
) As DbNewInstanceExpression
用法
Dim elements As DbExpression()
Dim returnValue As DbNewInstanceExpression
returnValue = DbExpressionBuilder.NewCollection(elements)
public static DbNewInstanceExpression NewCollection(
params DbExpression[] elements
)
public:
static DbNewInstanceExpression^ NewCollection(
... array<DbExpression^>^ elements
)
static member NewCollection :
elements:DbExpression[] -> DbNewInstanceExpression
public static function NewCollection(
... elements : DbExpression[]
) : DbNewInstanceExpression
参数
- elements
类型:System.Data.Entity.Core.Common.CommandTrees.DbExpression[]
提供集合元素的表达式列表。
返回值
类型:System.Data.Entity.Core.Common.CommandTrees.DbNewInstanceExpression
具有指定的集合类型和参数的一个新的 DbNewInstanceExpression。
异常
例外 | 条件 |
---|---|
ArgumentNullException | elements 为 null 或包含 null。 |
ArgumentException | elements 为空,或包含不存在通用结果类型的表达式。 |
请参阅
参考
System.Data.Entity.Core.Common.CommandTrees.ExpressionBuilder 命名空间