小编Jos*_*osh的帖子

在Windows 8中注册协议处理程序

我正在尝试注册我的应用程序,它将处理链接的打开,例如,http://stackoverflow.com.我需要为Windows 8明确地执行此操作,我在早期版本的Windows中使用它.根据MSDN,这在Win8中已经发生了变化.

我已经浏览了MSDN上的MSDN(msdn.microsoft.com/en-us/library/cc144154.aspx)页面上的默认程序页面.它为处理文件类型提供了很好的演练,但是对协议的细节很有帮助. 将应用程序注册到URL协议只涉及设置新协议所涉及的步骤,而不是如何正确地将新处理程序添加到现有协议.

我也尝试过其他SO帖子中列出的注册表设置.

还有一件事,应用程序不是Metro/Windows Store应用程序,因此在清单中添加条目对我来说不起作用.

windows windows-8

13
推荐指数
3
解决办法
9375
查看次数

传递一个数组

在下面的示例代码中,当我不包含class约束时,为什么对genric类型的ArrayMethod调用失败

public interface IFoo { }
public interface IBar : IFoo { }

public class Test
{
    public void ClassConstraintTest<T>() where T : class, IFoo
    {
        T[] variable = new T[0];
        ArrayMethod(variable);
    }

    public void GenericTest<T>() where T : IFoo
    {
        T[] variable = new T[0];
        ArrayMethod(variable);  // Compilation error:  Can't convert T[] to IFoo[]
    }

    public void InheritanceTest()
    {
        IBar[] variable = new IBar[0];
        ArrayMethod(variable);
    }

    public void ArrayMethod(IFoo[] args) { }
}
Run Code Online (Sandbox Code Playgroud)

c# generics

9
推荐指数
2
解决办法
278
查看次数

标签 统计

c# ×1

generics ×1

windows ×1

windows-8 ×1