Anonymous types are class types derive directly from object - LINQ

Q.  Which of the following statement is correct?
- Published on 31 Aug 15

a. Anonymous types are class types that derive directly from object.
b. Anonymous types are not class types that derive directly from object.
c. Anonymous types are class types that derive directly from System.Class.
d. None of the above

ANSWER: Anonymous types are class types that derive directly from object.
 
Anonymous types are class types that derive directly from object. You cannot cast to other type except object.Anonymous types are created by using new operator along with an object initializer.

Example:
var v = new {Website = “ CareerRide ”, Message = " Welcome " };
Console.WriteLine(v. Website + v.Message);

Post your comment / Share knowledge


Enter the code shown above:

(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)