An anonymous type is a simple data type created on the fly to store a set of values. Anonymous types provide a convenient way to encapsulate a set of read-only properties into a single object without having to explicitly define a type first. Anonymous types were introduced in C# 3.0. These data types are generated by the compiler rather than explicit class definition.
Example:
Output:
Name of Employee=Pankaj
City=Alwar
State =Rajasthan
How Its Works:
We can create an array of anonymously typed elements by combining an implicitly typed local variable and an implicitly typed array.
Name of Employee=Rahul
City=Jaipur
You need to be a premium member to use this feature. To access it, you'll have to upgrade your membership.
Become a sharper developer and jumpstart your career.
$0
$
. 00
monthly
For Basic members:
$20
For Premium members:
$45
For Elite members: