C#泛型

        private void button1_Click_1(object sender, EventArgs e)
        {
            People<string> pString = new People<string>();
            pString.Show("ganquanfu");
            People<int> pInt = new People<int>();
            pInt.Show(200);
        }
    }
    class People<r>
    {
        public void Show(r @object)
        {
            MessageBox.Show(@object.ToString());
        }
    }
posted @ 2013-05-04 18:14  Predator  阅读(134)  评论(0编辑  收藏  举报