示例#1
0
        public Grid(int width, int height, T defaultValue)
        {
            Check.IsStrictlyPositive(width);
            Check.IsStrictlyPositive(height);

            CreateCells(width, height);
            InitializeCells(defaultValue);

            Rows    = new GridRowCollection <T>(this);
            Columns = new GridColumnCollection <T>(this);
        }
示例#2
0
        public Grid(T[,] values)
        {
            Check.NotNull(values, nameof(values));

            int width  = values.GetLength(1);
            int height = values.GetLength(0);

            Check.IsStrictlyPositive(width);
            Check.IsStrictlyPositive(height);

            CreateCells(width, height);
            InitializeCells(values);

            Rows    = new GridRowCollection <T>(this);
            Columns = new GridColumnCollection <T>(this);
        }