You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

C#中JumpList实现报错求助:CS0176与CS1503问题

解决JumpList使用中的两个编译错误

错误1:CS0176

JumpList.AddToRecent(string)是静态方法,不能通过JumpList实例调用,必须直接用类型名JumpList来调用。

错误2:CS1503

JumpListLink的构造函数第一个参数要求传入字符串格式的可执行文件路径,而非System.Uri对象,直接传入路径字符串即可。

修正后的完整代码

if (TaskbarManager.IsPlatformSupported)
{
    // Create a jump list
    JumpList jumpList = JumpList.CreateJumpList();

    // Add recent items - 使用类名调用静态方法
    JumpList.AddToRecent("C:\\Path\\To\\RecentFile.txt");

    // Add custom tasks - 直接传入字符串路径
    JumpListLink customTask = new JumpListLink("C:\\Path\\To\\Executable.exe", "Custom Task");
    jumpList.AddUserTasks(customTask);

    // Save the jump list
    jumpList.Refresh();
}

内容的提问来源于stack exchange,提问作者user23179962

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.03 04:45:55