Why explicit better thatn implicity? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why explicit better thatn implicity?

dear friends why explicit variable better than implicity variable?

20th Mar 2019, 8:09 PM
Mohamad Ali Saeidi
Mohamad Ali Saeidi - avatar
1 Answer
0
No there not the same. You should use implicit variables only for read-only purposes, see https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/anonymous-types. I guess there would also be a memory allocation issue. If you are going to use a var where you could use a sbyte ... , wouldn't that be just wasteful. Conceptually, c# is by design strongly typed. Can we hence deduct a better performance if we implicitly type the variables? Looks more probable. Especially considering why that choice was made: https://en.wikipedia.org/wiki/Strong_and_weak_typing
20th Mar 2019, 11:53 PM
[No Name]