Are the technique for use var and generic types are closed? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Are the technique for use var and generic types are closed?

After explenation of generic using, I think var and generic for some way have same autodetecting of types.

13th Mar 2017, 8:52 PM
Ivaylo Naydenov
Ivaylo Naydenov - avatar
3 Answers
+ 6
Nope, remember that when you want to call a generic method/function, or create a new generic class, you have to tell it what datatype you are working with. Hence it doesn't have to autodetect datatypes cause you will be telling it anyway.
13th Mar 2017, 10:09 PM
Wen Qin
Wen Qin - avatar
27th Jul 2020, 11:52 PM
Ngandu Kennedy Bonianga
Ngandu Kennedy Bonianga - avatar
0
Aha, tnx for answer :)
15th Mar 2017, 8:34 PM
Ivaylo Naydenov
Ivaylo Naydenov - avatar