VB.Net
Person = New With {C#
.FirstName = "Ram",
.MiddleName = "Gopal",
.LastName = "Verma" }
var Person = New With {Above example is one of declaration of anonymous typed object where once a person object is created then this object is used as if object of some of real physical class.
FirstName = "Ram",
MiddleName = "Gopal",
LastName = "Verma" };
During compilation while the control reached at above code then the following are the steps that are performed internally.
- Compiler automatically generates anonymous class.
- It anonymously instantiate an object that contains the properties in anonymous type
- The instantiated object is assigned to the anonymous type variable "Person"
So object of anonymous type are used as of a normal class.
No comments:
Post a Comment