ProjectItem.FileNames[Int16] 属性

定义

获取与项目项关联的文件的完整路径和名称。

public:
 property System::String ^ FileNames[short] { System::String ^ get(short index); };
[System.Runtime.InteropServices.DispId(11)]
public string FileNames[short index] { [System.Runtime.InteropServices.DispId(11)] get; }
[<System.Runtime.InteropServices.DispId(11)>]
[<get: System.Runtime.InteropServices.DispId(11)>]
member this.FileNames(int16) : string
Public ReadOnly Property FileNames(index As Short) As String

参数

index
Int16

必需。 项目项的文件名的索引,从1到 FileCount

属性值

String

表示与项目项关联的文件的完整路径和名称的字符串。

属性

示例

Sub FileNamesExample()  
   Dim proj As Project  
   Dim projitems As ProjectItems  

   ' Reference the current solution and its projects and project items.  
   proj = DTE.ActiveSolutionProjects(0)  
   projitems = proj.ProjectItems  

   ' List the file name associated with the first project item.  
   MsgBox(projitems.Item(1).FileNames(1))  
End Sub  

注解

大多数项目项仅有一个与之关联的文件,但某些语言有时每个项都有多个文件。 例如, ProjectItem 用于和的中的窗 Visual Basic 体 Visual C# 表示源文件,该文件可以有另一个项目项(如 .resx 文件)。

当项目项的 ProjectItems 属性具有值并且 ProjectItem 对象表示磁盘上的筛选器文件夹时, FileNames[] 属性将仅返回筛选器文件夹的名称。

适用于