As per the title, is it possible to declare type-negating constraints in c# 4 ?
one use for this would be an option type.
public class Option
where A : !B
where B : !A
{
private readonly A a;
private readonly B b;
private Option(){}
public Option(A a)
{
this.a = a
}
public Option(B b)
{
this.b = b
}
}
runtime checking would of course work but you wouldn't have the benefit of type checking at compile time.