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.
Assembly : mscorlib (dans mscorlib.dll)
Public Shared Function GetTypeFromCLSID ( _ clsid As Guid, _ server As String, _ throwOnError As Boolean _ ) As Type
public static Type GetTypeFromCLSID( Guid clsid, string server, bool throwOnError )
public: static Type^ GetTypeFromCLSID( Guid clsid, String^ server, bool throwOnError )
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.
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.
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.
' 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())
// 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());
// 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 );
.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 SP1Windows 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.