TypeDescriptor.CreateInstance Yöntem

Tanım

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

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

Parametreler

provider
IServiceProvider

Hizmet sağlayan TypeDescriptionProvider hizmet sağlayıcısı. Bu parametre olabilir null.

objectType
Type

Type Oluşturulacak nesnenin sayısı.

argTypes
Type[]

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

args
Object[]

Nesnenin oluşturucusunun geçmesi için isteğe bağlı parametre değerleri dizisi. değilse null, öğe sayısı ile argTypesaynı olmalıdır.

Döndürülenler

İlişkili TypeDescriptionProvider bir veri bulunursa yedek veri türünün örneği; aksi takdirde, null.

Öznitelikler

Özel durumlar

objectType, nullveya argsnull olmadığı argTypesbir durumdurnull.

argTypes ve args farklı sayıda öğeye sahiptir.

Açıklamalar

yöntemi, CreateInstance belirtilen TypeDescriptionProvider veri türüyle ilişkili bir objectType öğesini arar. Bu yöntem ilk olarak parametresinden provider bir tür açıklaması sağlayıcısı almaya çalışır. Bu başarısız olursa, bir sağlayıcı için kendi iç tablolarını arar (bu girişler önceki çağrılar AddProvideraracılığıyla oluşturulmuştur). Bir sağlayıcı bulursa, bu yöntem oluşturma çağrısını bu nesneye temsilci olarak atar.

Devralanlara Notlar

Türetilen sınıf bir yedek örnek sağlamazsa, bu yöntem temel uygulamayı çağırmalıdır.

Şunlara uygulanır

Ayrıca bkz.