"If at first you don't succeed; call it version 1.0" :-Unknown

Pages

Wednesday, April 2, 2014

GET SET in C#

Get:
The get { } implementation must include a return statement. It can access any member on the class.

Set:
The set { } implementation receives the implicit argument 'value', which is the value to which the property is assigned.



using System;

class Example
{
    int _number;
    public int Number
    {
get
{
   return this._number;
}
set
{
   this._number = value;
}
    }
}




If u had any trouble just ask, Happy to help u :)
Stay Tune... Have a nice day... 'N happy Coding :)

No comments: