what is an anonymous class?

Answer Posted / narasimha

hi ,
look into this


Anonymous type is the type that is created anonymously.
Anonymous type is a class that is created automatically by
compiler in somewhere you can’t see directly while you are
declaring the structure of that class. Confusing? Let me
show you one example.

view plaincopy to clipboardprint?

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1 {
class Program {
static void Main(string[] args) {
Person _person = new Person { ID = 1, FirstName
= "Michael", LastName = "Sync" };
Console.WriteLine("Name: {0} {1}", _person.FirstName,
_person.LastName);
Console.ReadLine();
}
}
public class Person {
public int ID { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
}
}

Is This Answer Correct ?    0 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a local block?

894


What are the parts of methodology?

749


what is meant by Byte code concept in Java?

797


What are locale settings?

736


What are the advantages of encapsulation in java?

752


Which types of exceptions are caught at compile time?

786


Can we restart a dead thread in java?

747


What are features of java?

780


What is a singleton in genetics?

809


What is an arraylist in java?

721


How is abstraction implemented in java ?

731


What is Hierarchy of exception?

845


Can we clone singleton class in java?

727


Why lambda expression is used in java?

777


What does indexof return in java?

755