TypeDescriptionProvider.CreateInstance Yöntem

Tanım

Başka bir veri türüyle değiştirilebilen bir nesne oluşturur.

public:
 virtual System::Object ^ CreateInstance(IServiceProvider ^ provider, Type ^ objectType, cli::array <Type ^> ^ argTypes, cli::array <System::Object ^> ^ args);
public virtual object? CreateInstance(IServiceProvider? provider, Type objectType, Type[]? argTypes, object?[]? args);
[System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
public virtual object CreateInstance(IServiceProvider provider, Type objectType, Type[] argTypes, object[] args);
public virtual object? CreateInstance(IServiceProvider? provider, Type objectType, Type[]? argTypes, object[]? args);
public virtual object CreateInstance(IServiceProvider provider, Type objectType, Type[] argTypes, object[] args);
abstract member CreateInstance : IServiceProvider * Type * Type[] * obj[] -> obj
override this.CreateInstance : IServiceProvider * Type * Type[] * obj[] -> obj
[<System.Runtime.Versioning.UnsupportedOSPlatform("browser")>]
abstract member CreateInstance : IServiceProvider * Type * Type[] * obj[] -> obj
override this.CreateInstance : IServiceProvider * Type * Type[] * obj[] -> obj
Public Overridable Function CreateInstance (provider As IServiceProvider, objectType As Type, argTypes As Type(), args As Object()) As Object

Parametreler

provider
IServiceProvider

İsteğe bağlı bir hizmet sağlayıcısı.

objectType
Type

Oluşturulacak nesnenin türü. Bu parametre hiçbir zaman nulldeğildir.

argTypes
Type[]

Nesnenin oluşturucusunun geçirileceği parametre türlerini temsil eden isteğe bağlı bir tür dizisi. Bu dizi sıfır uzunlukta veya olabilir null .

args
Object[]

Nesnenin oluşturucusunun geçmesi için isteğe bağlı parametre değerleri dizisi.

Döndürülenler

yerine .Object

Öznitelikler

Açıklamalar

IServiceProvider parametresi tarafından provider belirtilen, sınıfının yöntemi TypeDescriptor.CreateInstance tarafından TypeDescriptor geçirilir. providerdeğilsenull, hizmet sağlayıcısı tür açıklaması sağlayıcısı tarafından oluşturma çağrısı hakkında ek bağlam elde etmek için kullanılabilir.

CreateInstance yöntemi ve virtual varsayılan olarak ise Activator.CreateInstanceparent yönteminin null sonucunu döndürür. değilse parentnull, bu yöntem üst sağlayıcının CreateInstance yöntemini çağırır.

Devralanlara Notlar

Türetilmiş sınıf bir yedek örnek sağlamakla ilgilenmiyorsa, yalnızca temel uygulamayı çağırması gerekir.

Şunlara uygulanır

Ayrıca bkz.