Quantcast
Channel: User Filip Milovanović - Software Engineering Stack Exchange
Viewing all articles
Browse latest Browse all 173

Comment by Filip Milovanović on C# var vs. interface vs. concrete class in object instantiation

$
0
0
Note that the first and the last approach (everything stated explicitly) were the only ones available in early versions of C#, so part of it is tradition / old habits. Type inference (var) and the shorthand were added later on; they are useful for keeping the code clean and concise. Type inference also serves to support certain features like anonymous types (where the type name is only known to the compiler).

Viewing all articles
Browse latest Browse all 173

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>