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
What is better - 'bit-shift a value' or 'multiply by 2'?
what is singleton class in java?
What is difference between identifier and variable?
What is the benefit of singleton pattern?
What one should take care of, while serializing the object?
How objects of a class are created if no constructor is defined in the class?
What is the public method modifier?
Is string serializable in java?
Can we have multiple public classes in a java source file?
Realized?
How can we make sure main() is the last thread to finish in java program?
What is string subsequence method?
what are synchronized methods and synchronized statements? : Java thread
What is ph and buffers?
what is the final keyword denotes in java?