IVsDataProvider.GetType 方法 (Guid, String)

解决一特定于提供程序类型名称为其对应的 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
    类型:Guid

    数据源 DDEX 标识符。

  • typeName
    类型:String

    一个提供程序特定的类型名称。

返回值

类型:Type
表示类型是从指定类型名称解析。指定的 DDEX 数据源的 Type 对象,如果找到,则为;否则,返回 nullnull 引用(在 Visual Basic 中为 Nothing)。

异常

异常 条件
ArgumentNullException

typeName 参数为 nullnull 引用(在 Visual Basic 中为 Nothing)。

[<ANY>]

DDEX 提供程序 GetType 实现的 GetType 或引发了异常。

备注

此方法检查参数值是否源为非空,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 安全性

请参阅

参考

IVsDataProvider 接口

GetType 重载

Microsoft.VisualStudio.Data.Core 命名空间