+ 1
Could you use this in WPF?
My school uses WPF instead of console, could I still use the var keyword there and how?
3 Antworten
+ 2
okay! Thanks for the help: D
0
U can use the var keyword if you dont want to tell the kind of specific datatype.
Let says i have
list<string> studentList = new list<string>();
studentList.Add("david");
studentList.Add("samuel");
Now let print the name of all students.
we can use
foreach(string stList in studentList)
{
MessageBox.Show(stList);
}
Or
U can use the var here
foreach(var stList in studentList)
{
MessageBox.Show(stList);
}
And it will work as if u specify string