This is my first question on this website as I try to find the information myself exhausting my immediate resources prior to bothering people however I have been unable to find the answer so far. I am taking a Udemy course in which the following code is being used:
foreach (var item in collection)
{
}
The instructor was using the object type declaration in the foreach loop instead of the built in "var" type. In my use of the loop regardless of the container class I use to parse through I do not see any difference in which datatype declaration I use, it seems the "var" does not care if the item is an object, simple variable, etc. Why would I use one over the other and does it matter?