/// <param name="path">The path information to modify. The path cannot contain any of the characters defined in <see cref="GetInvalidPathChars"/>.</param>
/// <param name="extension">The new extension (with or without a leading period). Specify <see langword="null"/> to remove an existing extension from path.</param>
/// <summary>[AlphaFS] Returns the directory information for the specified path string without the root information, for example: "C:\Windows\system32" returns: "Windows".</summary>
/// <returns>The <paramref name="path"/>without the file name part and without the root information (if any), or <see langword="null"/> if <paramref name="path"/> is <see langword="null"/> or if <paramref name="path"/> denotes a root (such as "\", "C:", or * "\\server\share").</returns>
/// <summary>[AlphaFS] Returns the directory information for the specified path string without the root information, for example: "C:\Windows\system32" returns: "Windows".</summary>
/// <returns>The <paramref name="path"/>without the file name part and without the root information (if any), or <see langword="null"/> if <paramref name="path"/> is <see langword="null"/> or if <paramref name="path"/> denotes a root (such as "\", "C:", or * "\\server\share").</returns>
/// <summary>Returns the extension of the specified path string.</summary>
/// <returns>
/// <para>The extension of the specified path (including the period "."), or null, or <see cref="string.Empty"/>.</para>
/// <para>If <paramref name="path"/> is null, this method returns null.</para>
/// <para>If <paramref name="path"/> does not have extension information,
/// this method returns <see cref="string.Empty"/>.</para>
/// </returns>
/// <exception cref="ArgumentException"/>
/// <exception cref="ArgumentNullException"/>
/// <param name="path">The path string from which to get the extension. The path cannot contain any of the characters defined in <see cref="GetInvalidPathChars"/>.</param>
/// <summary>Returns the extension of the specified path string.</summary>
/// <returns>
/// <para>The extension of the specified path (including the period "."), or null, or <see cref="string.Empty"/>.</para>
/// <para>If <paramref name="path"/> is null, this method returns null.</para>
/// <para>If <paramref name="path"/> does not have extension information,
/// this method returns <see cref="string.Empty"/>.</para>
/// </returns>
/// <exception cref="ArgumentException"/>
/// <param name="path">The path string from which to get the extension. The path cannot contain any of the characters defined in <see cref="GetInvalidPathChars"/>.</param>
/// <param name="checkInvalidPathChars"><see langword="true"/> will check <paramref name="path"/> for invalid path characters.</param>
/// <summary>Returns the file name and extension of the specified path string.</summary>
/// <returns>
/// The characters after the last directory character in <paramref name="path"/>. If the last character of <paramref name="path"/> is a
/// directory or volume separator character, this method returns <c>string.Empty</c>. If path is null, this method returns null.
/// </returns>
/// <exception cref="ArgumentException"/>
/// <param name="path">The path string from which to obtain the file name and extension. The path cannot contain any of the characters defined in <see cref="GetInvalidPathChars"/>.</param>
[SecurityCritical]
publicstaticstringGetFileName(stringpath)
{
returnGetFileName(path,true);
}
#endregion // .NET
#region AlphaFS
/// <summary>[AlphaFS] Returns the file name and extension of the specified path string.</summary>
/// <returns>
/// The characters after the last directory character in <paramref name="path"/>. If the last character of <paramref name="path"/> is a
/// directory or volume separator character, this method returns <c>string.Empty</c>. If path is null, this method returns null.
/// </returns>
/// <exception cref="ArgumentException"/>
/// <param name="path">The path string from which to obtain the file name and extension.</param>
/// <param name="checkInvalidPathChars"><see langword="true"/> will check <paramref name="path"/> for invalid path characters.</param>
[SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Justification = "Utils.IsNullOrWhiteSpace validates arguments.")]