using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication4
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            My_Indexers Ind = new My_Indexers();
            Ind[0] = 10;
            Ind[1] = "Ali";
            MessageBox.Show(Ind.GetMembers());
            MessageBox.Show(Ind[1].ToString()+"_"+Ind[0].ToString());   
        }
    }
    public class My_Indexers
    {
        public int x;
        public string y;
        public string GetMembers()
        {
            return y + "_" + x.ToString();
        }
        public object this[int i]
        {
            get
            {
                object Obj = null;
                switch (i)
                {
                    case 0:
                        Obj = x;
                        break;
                    case 1:
                        Obj = y;
                        break;
                }
                return Obj;
            }
            set
            {
                switch (i)
                {
                    case 0:
                        x = (int)value;
                        break;
                    case 1:
                        y = (string)value;
                        break;
                }
            }
        }
    }
}
