Project.Kind 属性

获取指示对象种类或类型的 GUID 字符串。

命名空间:  EnvDTE
程序集:  EnvDTE(在 EnvDTE.dll 中)

语法

声明
ReadOnly Property Kind As String
string Kind { get; }
property String^ Kind {
    String^ get ();
}
abstract Kind : string with get
function get Kind () : String

属性值

类型:String
表示对象类型的 GUID 字符串。
返回的值应转换为适当的Guid或平台等效类型,然后再干使用本机 GUID 数据类型的比较。这样可确保不同项目系统和客户端间的 GUID 字符串格式差异(例如大写和使用大括号)不会导致相等性检查产生错误结果。

备注

内置的项目类型中定义PrjKind。 环境扩展插件必须提供唯一定义的类型字符串。 此信息应在每个工具或语言的类型库或文档中可用。

示例

Sub KindExample2(ByVal dte As DTE2)

    ' Before running this example, open a project.

    Dim proj As Project = dte.Solution.Projects.Item(1)
    Dim item As ProjectItem
    Dim msg As String

    For Each item In proj.ProjectItems
        msg &= "    " & item.Name & _
            "  [Kind = " & item.Kind & "]" & vbCrLf
    Next

    MsgBox(proj.Name & "  [Kind = " & proj.Kind & _
        "] has the following project items:" & vbCrLf & vbCrLf & msg)
End Sub
public void KindExample2(DTE2 dte)
{
    // Before running this example, open a project.

    Project proj = dte.Solution.Projects.Item(1);
    string msg = "";

    foreach (ProjectItem item in proj.ProjectItems)
        msg += "    " + item.Name + "  [Kind = " + item.Kind + "]\n";

    MessageBox.Show(proj.Name + "  [Kind = " + proj.Kind + 
        "] has the following project items:\n\n" + msg); 
}

.NET Framework 安全性

请参阅

参考

Project 接口

EnvDTE 命名空间

其他资源

如何:编译和运行自动化对象模型代码示例