Pages

Wednesday, April 17, 2013

properties in c#

Properties

class student
    {
        public int studentID { get; set; }
        public string studentName { get; set; }
    }
    class Program
    {
        static void Main(string[] args)
        {
            student obj = new student();
            obj.studentID = 116;
            obj.studentName = "satya";
            Console.WriteLine("Student ID {0} and Student Name {1}", obj.studentID, obj.studentName);
            Console.ReadKey();
        }
    }

0 comments:

Post a Comment