コード例 #1
0
        public Cell AddCell(object cell, string cellName, CellsPropertyOptions options)
        {
            if (cell is IEnumerable && !(cell is string))
            {
                return(null);                                          //TODO: Is it OK to say cellObj is string? Why not change arg param to string? Why Value in "Cell" model is object then?
            }
            var col = ConfigCell(cell, cellName, options);

            return(col);
        }
コード例 #2
0
        public List <Cell> EmptyCells(CellsPropertyOptions options, int count = 1)
        {
            List <Cell> cells = new();

            for (int i = 0; i < count; i++)
            {
                cells.Add(EmptyCell(options));
            }

            return(cells);
        }
コード例 #3
0
        private static Cell ConfigCell(object cellObj, string cellName, CellsPropertyOptions options)
        {
            Cell cell = new(options.StartLocation) { Location = options.StartLocation };

            if (cellObj is string)
            {
                cell.Value = cellObj;
                ConfigByType(cellObj, cell);
                return(cell);
            }

            cell.Value = GetPropValue(cellObj, cellName);
            cell.Type  = cellObj.GetType();
            cell.Name  = cellName;

            ConfigByType(cellObj, cell);
            ConfigByName(cellObj, cellName, cell);
            return(cell);
        }
コード例 #4
0
 private Cell EmptyCell(CellsPropertyOptions options) => ConfigCell(string.Empty, string.Empty, options);