共用方式為


Project.Kind Property

Definition

Gets a GUID string indicating the kind or type of the object.

public:
 property System::String ^ Kind { System::String ^ get(); };
public:
 property Platform::String ^ Kind { Platform::String ^ get(); };
[System.Runtime.InteropServices.DispId(201)]
public string Kind { [System.Runtime.InteropServices.DispId(201)] get; }
[<System.Runtime.InteropServices.DispId(201)>]
[<get: System.Runtime.InteropServices.DispId(201)>]
member this.Kind : string
Public ReadOnly Property Kind As String

Property Value

A GUID string representing the type of object.

The return value should be converted to a proper Guid or a platform-equivalent type before doing comparisons using native GUID data types. This ensures that differences in the string formatting of the GUID across different project systems and clients (such as capitalization and use of braces) don't cause incorrect results from equality checks.

Attributes

Examples

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);   
}  

Remarks

Built-in project types are defined in PrjKind. Environment extensions must provide uniquely defined type strings. This information should be available in each tool or language's type library or documentation.

Applies to