共用方式為


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 提供者的 GetTypeGetType 實作會擲回例外狀況。

備註

這個方法會檢查來源參數值是否是空的 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 命名空間