Suggestion for C# language: Modification to the "new" keyword - Allow type inference in C# to use th

  • Thread starter Thread starter Nicholas Paldino [.NET/C# MVP]
  • Start date Start date
Anthony Jones said:
Seriously you find this:-

MyClass c = new();

Easier to read than

var x = new MyClass();

I'm not Jeff, but yeah. Completely.

The type is declared, a variable is allocated, and a new object of the
type is created and assigned to the variable. It feels completely
natural. While I know what var does, it looks like late binding. This
creates a slight pause where I have to stop, focus on what language I'm
using and decide, no this isn't late binding, it's an alternate syntax
for declaring the type.
 
Back
Top