Property in Tutorial in C sharp — C Sharp — ASP.Net Example
ASP.Net Example-Property in Tutorial in C sharp

Wednesday, April 27, 2011

Property in Tutorial in C sharp

Property is Smart Method.
below given property example.

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

namespace Property_example
{
    class Test
    {

        uint _myprop;
        public uint MyProp
        {
            set
            {
                _myprop=value;
            }
            get { return _myprop; }
        }
        static void Main(string[] args)
        {
            Test t = new Test();
            t.MyProp = 100;
            Console.Write("Positive No. "+t.MyProp);

            Console.ReadLine();
        }
    }
}

No comments:

Post a Comment

ASPdotNET-Example