Monday 11 September 2017

Structure C#

namespace ConsoleApplication1
{
    struct School
    {
        public int roll;
        public string name;
        public string city;
    }

    class Program
    {
        static void Main(string[] args)
        {
            School ob;
            ob.roll = 101;
            ob.name = "sona";
            ob.city = "Vns";
            Console.WriteLine("\nRoll={0}\nName={1}\nCity={2}", ob.roll, ob.name, ob.city);
        }
    }

}

Output:


No comments:

Post a Comment