ObjectSet<TEntity>.CreateObject<T> 方法
[此頁面專屬於 Entity Framework 第 6 版。最新版本可從 'Entity Framework' NuGet 套件取得。如需 Entity Framework 的詳細資訊,請參閱 msdn.com/data/ef。]
建立指定類型的執行個體。
命名空間: System.Data.Entity.Core.Objects
組件: EntityFramework (在 EntityFramework.dll 中)
語法
'宣告
Public Function CreateObject(Of T As {Class, TEntity}) As T
'用途
Dim instance As ObjectSet
Dim returnValue As T
returnValue = instance.CreateObject()
public T CreateObject<T>()
where T : class, TEntity
public:
generic<typename T>
where T : ref class, TEntity
T CreateObject()
member CreateObject : unit -> 'T when 'T : not struct and 'TEntity
JScript does not support generic types and methods.
類型參數
- T
要傳回的物件類型。
傳回值
類型:T
所要求類型 T 的執行個體,或者是對應到類型 T 的 Proxy 類型執行個體。