NLog.Targets.FileTarget.ContainsFileNamePattern C# (CSharp) Method

ContainsFileNamePattern() private static method

Determines if the file name as String contains a numeric pattern i.e. {#} in it. Example: trace{#}.log Contains the numeric pattern. trace{###}.log Contains the numeric pattern. trace{#X#}.log Contains the numeric pattern (See remarks). trace.log Does not contain the pattern.
Occasionally, this method can identify the existence of the {#} pattern incorrectly.
private static ContainsFileNamePattern ( string fileName ) : bool
fileName string File name to be checked.
return bool
        private static bool ContainsFileNamePattern(string fileName)
        {
            int startingIndex = fileName.IndexOf("{#", StringComparison.Ordinal);
            int endingIndex = fileName.IndexOf("#}", StringComparison.Ordinal);

            return (startingIndex != -1 && endingIndex != -1 && startingIndex < endingIndex);
        }