Dieser Artikel wurde maschinell übersetzt. Wenn Sie die englische Version des Artikels anzeigen möchten, aktivieren Sie das Kontrollkästchen Englisch. Sie können den englischen Text auch in einem Popupfenster anzeigen, indem Sie den Mauszeiger über den Text bewegen.
Übersetzung
Englisch

TypeDescriptor.AddProvider-Methode (TypeDescriptionProvider, Type)

 

Fügt einen Typbeschreibungsanbieter für eine Komponentenklasse hinzu.

Namespace:   System.ComponentModel
Assembly:  System (in System.dll)

[PermissionSetAttribute(SecurityAction.LinkDemand, Name = "FullTrust")]
public static void AddProvider(
	TypeDescriptionProvider provider,
	Type type
)

Parameter

provider
Type: System.ComponentModel.TypeDescriptionProvider

Das hinzuzufügende TypeDescriptionProvider.

type
Type: System.Type

Der Type der Zielkomponente.

Exception Condition
ArgumentNullException

Ein oder beide Parameter sind null.

The M:System.ComponentModel.TypeDescriptor.AddProvider(System.ComponentModel.TypeDescriptionProvider,System.Type) method adds a type description provider that supplies type information for the specified class, derived classes, and all instances of these types.

System_CAPS_noteHinweis

The type parameter can be any type, including an interface. For example, to provide custom type and instance information for all components, you would specify typeof(IComponent). Passing typeof(object) will call the provider to supply type information for all types.

This method does not maintain a hard reference to any object, so it does not prevent objects from finalizing.

It is possible to add multiple type description providers for the same type or object. If this occurs, the first type description provider encountered that provides type information will be used exclusively. Because type information providers are stored in a stack, the last provider added will be the first one queried. This behavior enables the M:System.ComponentModel.TypeDescriptor.AddProvider(System.ComponentModel.TypeDescriptionProvider,System.Type) and Overload:System.ComponentModel.TypeDescriptor.RemoveProvider methods to be used to push and pop type description providers as required for particular scenarios.

If successful, this method calls the M:System.ComponentModel.TypeDescriptor.Refresh(System.Type) method on the type parameter.

System_CAPS_noteHinweis

The two versions of this method produce results with different scopes. The Overload:System.ComponentModel.TypeDescriptor.AddProvider method that takes an T:System.Object parameter affects only that single instance of the component specified. In contrast, the other overload, which takes a T:System.Type parameter, affects all instances of the component described by that type.

Use the M:System.ComponentModel.TypeDescriptor.AddProviderTransparent(System.ComponentModel.TypeDescriptionProvider,System.Type) method if you need to call from partially trusted code.

NamedPermissionSet

for full access to system resources. Demand value: F:System.Security.Permissions.SecurityAction.LinkDemand. Associated state:

.NET Framework
Verfügbar seit 2.0
Zurück zum Anfang
Anzeigen: