用文件资源管理器定位操作类 - C#小函数类推荐

/***

    用文件资源管理器定位操作类

    Austin Liu 刘恒辉
    Project Manager and Software Designer

    E-Mail: [email protected]
    Blog:   http://lzhdim.cnblogs.com
    Date:   2024-01-15 15:18:00

    使用方法例子:
        OpenInExplorerUtil.OpenFileInExplorer(Application.ExecutablePath());

***/

namespace Lzhdim.LPF.Utility
{
    using System.Diagnostics;

    /// 
    /// 用文件资源管理器定位操作类
    /// 
    public sealed class OpenInExplorerUtil
    {
        /// 
        /// 用文件资源管理器定位文件
        /// 
        /// 文件路径
        public static void OpenFileInExplorer(string filePath)
        {
            Process.Start("explorer.exe", $"/select, \"{filePath}\"");
        }

        /// 
        /// 用文件资源管理器定位文件夹
        /// 
        /// 文件夹路径
        public static void OpenFolderInExplorer(string folderPath)
        {
            Process.Start("explorer.exe", folderPath);
        }
    }
}

你可能感兴趣的:(c#,开发语言)