Find.FilesOfType 属性

获取或设置要搜索的文件的文件扩展名。

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

语法

声明
Property FilesOfType As String
string FilesOfType { get; set; }
property String^ FilesOfType {
    String^ get ();
    void set (String^ value);
}
abstract FilesOfType : string with get, set
function get FilesOfType () : String 
function set FilesOfType (value : String)

属性值

类型:String
要搜索的文件的文件扩展名。

备注

FilesOfType 参数可以是任何三字符的文件扩展名,例如 .bas、.cpp、.txt 等。 而且,FilesOfType 对应于**“文件类型”**框。 它是要搜索的通配符模式的分号分隔列表。 其功能与 MS-DOS 的 dir 命令类似。 例如,可以将 FilesOfType 设置为 MyProg*.cpp。 但是,只能在文件上使用通配符,不能在目录上使用。 例如,不可使用 Sample*\abc*.cpp。

示例

Sub FilesOfTypeExample()
   Dim objTextDoc As TextDocument
   Dim objEditPt As EditPoint
   Dim iCtr As Integer
   Dim objFind As Find

   ' Create a new text file.
   DTE.ItemOperations.NewFile("General\Text File")

   ' Get a handle to the new document and create an EditPoint.
   objTextDoc = DTE.ActiveDocument.Object("TextDocument")
   objEditPt = objTextDoc.StartPoint.CreateEditPoint
   objFind = objTextDoc.DTE.Find

   ' Insert ten lines of text.
   For iCtr = 1 To 10
      objEditPt.Insert("This is a test." & Chr(13))
   Next iCtr

   ' Set the find options.
   objFind.Action = vsFindAction.vsFindActionReplaceAll
   objFind.Backwards = False
   objFind.FilesOfType = "*.txt"
   objFind.FindWhat = "test"
   objFind.KeepModifiedDocumentsOpen = True
   objFind.MatchCase = False
   objFind.MatchInHiddenText = False
   objFind.MatchWholeWord = True
   objFind.PatternSyntax = vsFindPatternSyntax.vsFindPatternSyntaxLiteral
   objFind.ReplaceWith = "NEW THING"
   objFind.ResultsLocation = vsFindResultsLocation.vsFindResultsNone
   objFind.SearchPath = "c:\temp"
   objFind.SearchSubfolders = False
   objFind.Target = vsFindTarget.vsFindTargetCurrentDocument
   ' Perform the Find operation.
   objFind.Execute()
End Sub

.NET Framework 安全性

请参阅

参考

Find 接口

EnvDTE 命名空间