I just found out that the var keyword can be used as the class name:
public class var // no problem here { }
Now, if I overload the implicit casting operator, I can use my class in an interesting way:
namespace MyApp { class Program { static void Main(string[] args) { var x = 1;
In such a scenario, is it still possible to somehow force the compiler to infer types? This blog entry says itโs not possible (skip to the paragraph starting with โOr, another exampleโ), but maybe something has changed since 2009
c # var
Kapol
source share