VCCodeInterface.Location[vsCMWhere] 属性

定义

获取对象声明的位置。

public:
 property System::String ^ Location[Microsoft::VisualStudio::VCCodeModel::vsCMWhere] { System::String ^ get(Microsoft::VisualStudio::VCCodeModel::vsCMWhere Where); };
[System.Runtime.InteropServices.DispId(549)]
public string Location[Microsoft.VisualStudio.VCCodeModel.vsCMWhere Where = Microsoft.VisualStudio.VCCodeModel.vsCMWhere.vsCMWhereDefault] { [System.Runtime.InteropServices.DispId(549)] get; }
[<System.Runtime.InteropServices.DispId(549)>]
[<get: System.Runtime.InteropServices.DispId(549)>]
member this.Location(Microsoft.VisualStudio.VCCodeModel.vsCMWhere) : string
Public ReadOnly Property Location(Optional Where As vsCMWhere = Microsoft.VisualStudio.VCCodeModel.vsCMWhere.vsCMWhereDefault) As String

参数

Where
vsCMWhere

可选。 一个 vsCMWhere 值,指定是返回声明的位置还是定义的位置。

属性值

String

对象声明的位置。

属性

示例

此示例显示包含每个顶级代码元素的声明的文件。

[Visual Basic]

Sub DisplayLocation()  
    Dim vcCM As VCCodeModel  
    Dim vcCodeElement As VCCodeElement  
    vcCM = DTE.Solution.Item(1).CodeModel  
    For Each vcCodeElement In vcCM.CodeElements  
        MsgBox(vcCodeElement.Name + " is declared in " + vcCodeElement.Location)  
    Next  
End Sub  

注解

有关如何编译和运行此示例的信息,请参阅 如何:编译 Visual C++ 代码模型扩展性的示例代码

适用于