Answer 1.
In c# 3.0 you can create an instance of a class without having to write code for the class beforehand. So, you now can write code as shown below:
new {city="Queens", state="NY", country="US"}
Behind the scenes, the C# compiler would create a class that looks as follows:
class __Anonymous123
{
private string _city = "Queens";
private string _state = "NY";
private int _country = "US";
public string city {get { return _city; } set { _city = value; }}
public string state {get { return _state; } set { _state= value; }}
public string country {get { return _country; } set { _country = value; }}
}
Posted By: QP Admin
Post Date: 04/14/2008
|
Answer 2.
Are you sure this answer is frutfull...?
|