共用方式為


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
    型別:System.Guid
    DDEX 資料來源識別項。

傳回值

型別:System.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 命名空間