Skip to main content

Property in c sharp #

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

namespace My
{
 
    class MyClass
    {

        int id { get; set; }
        string name { get; set; }
        static void Main(string[] args)
        {
            MyClass ob = new MyClass();
            ob.id = 101;
            Console.WriteLine(ob.id);
            Console.Write(ob.name);
            // it will produce blank or null value
            ob.name = "anuj";
            Console.WriteLine(ob.name);
                        Console.Read();        

        }


    }
}

Comments

Popular posts from this blog

unix commands