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
類型:GuidDDEX 資料來源識別項。
typeName
類型:String一個提供者特定的型別名稱。
傳回值
類型: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 安全性
- 完全信任立即呼叫者。這個成員無法供部分信任的程式碼使用。如需詳細資訊,請參閱從部分受信任程式碼使用程式庫。