共用方式為


Reference3.SubType 屬性

設定或取得組件子型別。

命名空間:  VSLangProj80
組件:  VSLangProj80 (在 VSLangProj80.dll 中)

語法

'宣告
Property SubType As String
    Get
    Set
string SubType { get; set; }
property String^ SubType {
    String^ get ();
    void set (String^ value);
}
abstract SubType : string with get, set
function get SubType () : String
function set SubType (value : String)

屬性值

型別:System.String
字串值,表示組件的子型別。針對 SQL Server Visual Basic 或 Visual C# 專案,如果是從目標 SQL Server 擷取參考,此屬性會設定為 SQLCLR。

備註

此屬性僅適用於 SQL Server Visual Basic 或 Visual C# 專案。

範例

此範例會將參考加入至開啟的 Visual Basic 或 Visual C# 專案中,並且會顯示參考子型別 (如果有的話)。 若要將此範例當做增益集來執行,請參閱 HOW TO:編譯和執行 Automation 物件模型程式碼範例

新增的參考之預設路徑為:<drive>:\Program Files\Microsoft SQL Server\90\COM。 以這個或另一個適當的檔案路徑取代範例中的 <file path>。

Imports VSLangProj
Imports VSLangProj2
Imports VSLangProj80
Public Sub OnConnection(ByVal application As Object, _
 ByVal connectMode As ext_ConnectMode, ByVal addInInst As Object, _
 ByRef custom As Array) Implements IDTExtensibility2.OnConnection
    applicationObject = CType(application, DTE2)
    addInInstance = CType(addInInst, AddIn)
    DisplaySubType(applicationObject)
End Sub
Sub DisplaySubType(ByVal dte As DTE2)
    Dim aProject As Project
    Dim aVSProject As VSProject2
    aProject = applicationObject.Solution.Projects.Item(1)
    aVSProject = _
    CType(applicationObject.Solution.Projects.Item(1).Object, _
    VSProject2)
    ' Add an Assembly reference and display its subtype.
    Dim newRef As Reference3
    ' Replace <file path> with an actual file path.
    newRef = CType(aVSProject.References.Add _
("<file path>\sqldistx.dll "), Reference3)
    MsgBox("Added an assembly reference, named: " & newRef.Name)
    MsgBox("The SubType of " & newRef.Name & " is " _
    & newRef.SubType)
End Sub
using System.Windows.Forms;
using VSLangProj;
using VSLangProj2;
using VSLangProj80;
public void OnConnection(object application,
 ext_ConnectMode connectMode, object addInInst, ref Array custom)
{
    applicationObject = (DTE2)application;
    addInInstance = (AddIn)addInInst;
    DisplaySubType(((DTE2)applicationObject));
}
public void DisplaySubType(DTE2 dte)
{
    // The first project is a Visual Basic or C# project.
VSProject2 vsProject =
((VSProject2)(applicationObject.Solution.Projects.Item(1).Object));
    Reference3 aRef = null;
    // Add an Assembly reference and display its subtype.
    // Replace <file path> with an actual file path.
    aRef = (Reference3)vsProject.References.Add
((@"<file path>\sqldistx.dll"));
    MessageBox.Show("Added reference, named: "
+ aRef.Name);
MessageBox.Show("The SubType of " + aRef.Name + " is "
+ aRef.SubType);
}

.NET Framework 安全性

請參閱

參考

Reference3 介面

VSLangProj80 命名空間