Resolves a provider-specific type name to its corresponding Type representation, for a specific DDEX data source.
Namespace: Microsoft.VisualStudio.Data.Core
Assembly: Microsoft.VisualStudio.Data.Core (in Microsoft.VisualStudio.Data.Core.dll)
Syntax
'宣言
Function GetType ( _
source As Guid, _
typeName As String _
) As Type
'使用
Dim instance As IVsDataProvider
Dim source As Guid
Dim typeName As String
Dim returnValue As Type
returnValue = instance.GetType(source, _
typeName)
Type GetType(
Guid source,
string typeName
)
Type^ GetType(
Guid source,
String^ typeName
)
function GetType(
source : Guid,
typeName : String
) : Type
Parameters
source
Type: System.GuidA DDEX data source identifier.
typeName
Type: System.StringA provider-specific type name.
Return Value
Type: System.Type
A Type object that represents the type that is resolved from the specified type name for the specified DDEX data source, if it is found; otherwise, a null reference (Nothing in Visual Basic).
Exceptions
| Exception | Condition |
|---|---|
| ArgumentNullException | The typeName parameter is a null reference (Nothing in Visual Basic). |
| [<ANY>] | The DDEX provider's GetType or GetType implementation threw an exception. |
Remarks
This method checks whether the source parameter value is a non-empty GUID, and, if it is, calls the DDEX provider’s GetType method, if one exists. If no type is available at this point, it calls the GetType method.
Examples
The following code demonstrates how to call this method with a provider-specific type name and then create an instance of this type.
using System;
using Microsoft.VisualStudio.Data.Core;
using Microsoft.VisualStudio.Data.Services.SupportEntities;
public class DDEX_IVsDataProviderExample6
{
public static IVsDataObjectSelector CreateObjectSelector(
IVsDataProvider provider, string objectSelectorTypeName)
{
Type objectSelectorType = provider.GetType(objectSelectorTypeName);
return Activator.CreateInstance(objectSelectorType)
as IVsDataObjectSelector;
}
}
Permissions
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.