- Anonymous types in C# are a new concept which shipped with .net framework 3.5
- Anonymous types are nothing but it simply states that we dont have to define a type and that type is defined automatically by C# analysing the right hand side.
- Anonymous Types are very important in the LINQ word.
- Keyword var is used to declare an anonymous type.
- They are immutable and thus dont require any property getter or setter methods
- They must always be initialized so that the compiler can build the type defination and bind the anonymous type with that , and it is only possible only when we have any thing in the right hand side of an anonymous type thus anonymous types should always be initialized.
//1.Shows Simple anonymous varible declarations and iterating using for loop
//2.Show Simple anonymous variable declarations and iterating using foreach loop
//3.Linq query used as iterand in foreach statement.