解析一个提供程序特定的类型名称与其对应的 Type 表示,的特定DDEX数据源。
命名空间: Microsoft.VisualStudio.Data.Core
程序集: Microsoft.VisualStudio.Data.Core(在 Microsoft.VisualStudio.Data.Core.dll 中)
语法
声明
Function GetType ( _
source As Guid, _
typeName As String _
) As Type
Type GetType(
Guid source,
string typeName
)
Type^ GetType(
Guid source,
String^ typeName
)
abstract GetType :
source:Guid *
typeName:string -> Type
function GetType(
source : Guid,
typeName : String
) : Type
参数
- source
类型:System.Guid
DDEX数据源标识符。
- typeName
类型:System.String
一个提供程序特定的类型名称。
返回值
类型:System.Type
表示类型从指定的DDEX数据源指定类型的名称解析的 Type 对象,因此,如果找到;否则,nullnull 引用(在 Visual Basic 中为 Nothing)。
异常
异常 | 条件 |
---|---|
ArgumentNullException | typeName 参数为 nullnull 引用(在 Visual Basic 中为 Nothing)。 |
[<ANY>] |
备注
此方法检查源参数值是否为非空的GUID,则为;如果为,调用DDEX提供程序的 GetType 方法,即,如果存在)。如果类型此时不可用,则调用 GetType 方法。
示例
下面的代码演示如何调用带有一个提供程序特定的类型名称的则此方法创建该类型的实例。
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;
}
}
.NET Framework 安全性
- 对直接调用方的完全信任。此成员不能由部分信任的代码使用。有关更多信息,请参见通过部分受信任的代码使用库。