Monday, 23 April 2018

Find the string value through get and set method

Find the string value through get and set method
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication33
{
    class program
    {
        string[] s = new string[5];
        public string this[int i]
        {
            set
            {
                s[i] = value;
            }
            get
            {
                return s[i];
            }
        }
        static void Main(string[] args)
        {
            program p = new program();
            p[0] = "tmimt";
            p[1] = "Delhi Road";
            p[2] = "mbd";
            Console.WriteLine("{0} {1} {2}", p[0], p[1], p[2]);
            Console.ReadLine();
        }
    }
}
https://www.youtube.com/channel/UCKLRUr6U5OFeu7FLOpQ-FSw/videos

0 comments

Post a Comment