Type.GetTypeFromCLSID, méthode (Guid, String, Boolean) (System)

Changer de vue:
ScriptFree
Bibliothèque de classes .NET Framework
Type.GetTypeFromCLSID, méthode (Guid, String, Boolean)
Cet article a fait l'objet d'une traduction manuelle. Pour afficher simultanément cette page et le contenu source en anglais, choisissez le paramètre d'affichage Basse densité.

Obtient le type associé à l'identificateur de classe (CLSID) spécifié à partir du serveur défini, indiquant s'il faut lever une exception en cas d'erreur pendant le chargement du type.

Espace de noms :  System
Assembly :  mscorlib (dans mscorlib.dll)
Syntaxe

Visual Basic
Public Shared Function GetTypeFromCLSID ( _
	clsid As Guid, _
	server As String, _
	throwOnError As Boolean _
) As Type
C#
public static Type GetTypeFromCLSID(
	Guid clsid,
	string server,
	bool throwOnError
)
VisualC++
public:
static Type^ GetTypeFromCLSID(
	Guid clsid, 
	String^ server, 
	bool throwOnError
)
F#
static member GetTypeFromCLSID : 
        clsid:Guid * 
        server:string * 
        throwOnError:bool -> Type 

Paramètres

clsid
Type : System.Guid
CLSID du type à obtenir.
server
Type : System.String
Serveur à partir duquel le type doit être chargé. Si le nom de serveur est null, cette méthode revient automatiquement à la machine locale.
throwOnError
Type : System.Boolean
true pour lever toute exception qui se produit.
ou
false pour ignorer toute exception qui se produit.

Valeur de retour

Type : System.Type
System.__ComObject que le CLSID soit valide ou non.
Notes

Des exceptions telles que OutOfMemoryException seront levées en cas de spécification de true pour throwOnError, mais l'annulation de l'inscription du CLSID n'échouera pas.

Exemples

L'exemple suivant récupère le type associé à l'identificateur de classe (CLSID) à partir de l'hôte local, indiquant s'il faut lever une exception en cas d'erreur pendant le chargement du type.

Visual Basic

' Create a GUID.
Dim myGuid3 As New Guid("8D8529D3-625D-4496-8354-3DAD630ECC1B")
' Get the type associated with the CLSID
' from the local host and specify whether to throw an exception if an 
' error occurs while loading the type.
Dim myType3 As Type = Type.GetTypeFromCLSID(myGuid3, ".", True)
Console.WriteLine("The GUID associated with myType3 is {0}.", myType3.GUID.ToString())
Console.WriteLine("The type of the GUID is {0}.", myType3.ToString())


C#

// Create a GUID.
Guid myGuid3 = new Guid("8D8529D3-625D-4496-8354-3DAD630ECC1B");
// Get the type associated with the CLSID
// from the local host and specify whether to throw an exception if an 
// error occurs while loading the type.
Type myType3 =Type.GetTypeFromCLSID(myGuid3, ".", true);
Console.WriteLine("The GUID associated with myType3 is {0}.", myType3.GUID);
Console.WriteLine("The type of the GUID is {0}.", myType3.ToString()); 


VisualC++

// Create a GUID.
Guid myGuid3 = Guid("8D8529D3-625D-4496-8354-3DAD630ECC1B");
// Get the type associated with the CLSID
// from the local host and specify whether to throw an exception if an
// error occurs while loading the type.
Type^ myType3 = Type::GetTypeFromCLSID( myGuid3, ".", true );
Console::WriteLine( "The GUID associated with myType3 is {0}.", myType3->GUID );
Console::WriteLine( "The type of the GUID is {0}.", myType3 );


Informations de version

.NET Framework

Pris en charge dans : 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Pris en charge dans : 4, 3.5 SP1
Plateformes

Windows 7, Windows Vista SP1 ou ultérieur, Windows XP SP3, Windows XP SP2 Édition x64, Windows Server 2008 (installation minimale non prise en charge), Windows Server 2008 R2 (installation minimale prise en charge avec SP1 ou version ultérieure), Windows Server 2003 SP2

Le .NET Framework ne prend pas en charge toutes les versions de chaque plateforme. Pour obtenir la liste des versions prises en charge, consultez Configuration requise du .NET Framework.
Voir aussi

Référence