+ 3

Can I use keyword “var” in function (method)?

The “var” keyword is universal keyword for each type, but I can’t change a type – I now. But can I use this keyword in arguments of method, for example: using System; ... public string GetSum(var num) { return num.ToString() + " + 3 = " + (Int32.Parse(num) + 3); } ... byte a = 3; GetSum(a); Int32 b = 4; GetSum(b);

3rd Apr 2019, 5:58 PM
Tomáš Wróbel
Tomáš Wróbel - avatar
3 Respostas
3rd Apr 2019, 6:38 PM
dρlυѕρlυѕ
dρlυѕρlυѕ - avatar
+ 3
Thank you for your answer. 😃
4th Apr 2019, 4:45 AM
Tomáš Wróbel
Tomáš Wróbel - avatar