語言

FileSystemName.MatchesWin32Expression 方法

定義

驗證給定的 Win32 表達式是否與名稱相符。 支援以下萬用字札:「*」、「?」、「」、「<>」。 反斜線字元 '\' 逃脫了。

public static bool MatchesWin32Expression(ReadOnlySpan<char> expression, ReadOnlySpan<char> name, bool ignoreCase = true);
static member MatchesWin32Expression : ReadOnlySpan<char> * ReadOnlySpan<char> * bool -> bool
Public Shared Function MatchesWin32Expression (expression As ReadOnlySpan(Of Char), name As ReadOnlySpan(Of Char), Optional ignoreCase As Boolean = true) As Boolean

參數

expression
ReadOnlySpan<Char>

與之匹配的表達式,例如「*.foo」。

name
ReadOnlySpan<Char>

這個名字可以用這個表情來比對。

ignoreCase
Boolean

true 忽略大小寫(預設), false 如果匹配應該是區分大小寫的。

傳回

true若給定表達式與名稱相符;否則,。 false

備註

參數expression的語法基於 所使用的FileSystemWatcher語法,而 則是基於 RtlIsNameInExpression,該表達式定義了匹配 DOS 萬用字元的規則('*', '?', '<''>''"', , )。

除非你用 TranslateWin32Expression(String)來轉換表達式,否則匹配不會對應 Win32 的行為。

適用於