Implicit type casting and intersection/union types

Topics: C# Language Design
Jun 22, 2014 at 12:34 PM
My first suggestion is implementing implicit type casts if we have explicitly checked the type already:
public override bool Equals(object obj)
   if (obj is Class1) {
      //obj = obj as Class1 implemented automatically
      return this==obj; //no need to cast explicitly, inside this block we are sure that obj is an instance of Class1
   } else {
      return false;
My other suggestion goes beyond C# and touches the foundations of .net, I'm afraid. I'm talking about intersection and union types a la Ceylon. I'm not even going to try to come up with a good example, but will point you to their documentation instead: