定义item:
 public class TestItem
    {
        TestLine testLine = null;
        public TestLine this[int line]
        {
            get
            {
                if (testLine == null)
                {
                    testLine = new TestLine();
                }
                return testLine;
            }
        }
    }
定义line
public class TestLine
    {
        string strTest = "";
        public string this[int i]
        {
            get
            {
                strTest = "值为:" + i;
                return strTest;
            }
            set
            {
                strTest = "值为:" + i;
            }
        }
    }
使用[][]
:
TestItem item = new TestItem();
            MessageBox.Show(item[4][5]);

相关文章:

  • 2021-06-08
  • 2021-09-03
  • 2022-12-23
  • 2022-12-23
  • 2021-06-01
  • 2022-01-01
  • 2021-10-19
  • 2022-12-23
猜你喜欢
  • 2022-02-15
  • 2021-11-18
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-03
  • 2022-01-04
相关资源
相似解决方案