Monday, October 29, 2018

When to Use ''Var'' as a Type

It has been quite a long time since var was introduced, yet it remains a topic of debate among .NET developers. Everyone has a different understanding about when to use "var" as a type. A couple of days ago, I was also a part of one such discussion, and so through this article, I would like to share my understanding of the topic.

Readability

Every developer has all the rights to use var as and when they like, it's just a matter of one's choice. However, one must keep in mind that every line of code should be self-explanatory and developer-readable. Let's have a look at the below code:



from DZone.com Feed https://ift.tt/2qjLA17

No comments:

Post a Comment