Friday, December 21, 2007

Mundane get() set() got smart in the Framework 3.5

In this Blog Feature i will explain the New concepts of Framework 3.5 and the Visual Studio 2008 IDE.

The following are the new features of the framework 3.5



1) Automatic Property Setter.

eg:

pulbic class Person

{
private string _name;
private string _address;
private int _age;

// Normal Getter Sertter Logic For the Properties

public string Name
{
get{ return _name;}
set{ _name=value;}
}

public string Address
{
get{return _address;}
set{ _address=value;}
}

public int Age
{
get{ return _age}
set{ _age=value;}
}

}





After the New visual studio 2008 with the new framework we would do this in the following way.



class Person

{

public string Name {get;set;}

public string Address{get;set;}

public int age {get;set;}

}

No comments: