diff --git a/ExcelTool/Parser/TableExcelData.cs b/ExcelTool/Parser/TableExcelData.cs index 17d1ec1..7f1d7ec 100644 --- a/ExcelTool/Parser/TableExcelData.cs +++ b/ExcelTool/Parser/TableExcelData.cs @@ -5,28 +5,20 @@ namespace ExcelTool.Parser { public class TableExcelData { - List headers = new(); - List rows = new(); - public int CollonCount = 0; - public int RowCounts = 0; + public readonly int ColumnCount = 0; + public readonly int RowCounts = 0; + + public List Headers { get; } + public List Rows { get; } public TableExcelData(IEnumerable headers, IEnumerable rows) { - this.headers = headers.ToList(); - this.rows = rows.ToList(); - this.CollonCount = this.headers.Count; - this.RowCounts = this.rows.Count; + Headers = headers.ToList(); + Rows = rows.ToList(); + this.ColumnCount = Headers.Count; + this.RowCounts = Rows.Count; } - public List Headers - { - get { return this.headers; } - } - - public List Rows - { - get { return this.rows; } - } //TODO:待检查数据类型的合法性 //public bool CheckUnique(out string errorMsg) diff --git a/ExcelTool/Parser/TableExcelExportBytes.cs b/ExcelTool/Parser/TableExcelExportBytes.cs index 4aba69b..df33dad 100644 --- a/ExcelTool/Parser/TableExcelExportBytes.cs +++ b/ExcelTool/Parser/TableExcelExportBytes.cs @@ -18,7 +18,7 @@ namespace ExcelTool.Parser datas.Add(rowCount); foreach (var row in sheet.Data.Rows) { - for (int i = 0; i < sheet.Data.CollonCount; i++) + for (int i = 0; i < sheet.Data.ColumnCount; i++) { var type = sheet.Data.Headers[i].FieldType.ToLower(); var data = row.StrList[i]; diff --git a/ExcelTool/Program.cs b/ExcelTool/Program.cs index d506159..21eac2b 100644 --- a/ExcelTool/Program.cs +++ b/ExcelTool/Program.cs @@ -14,7 +14,7 @@ namespace ExcelTool string outputDataDir = ""; string nameSpace = ""; - foreach (var arg in args) + foreach (string arg in args) { if (arg.StartsWith("--input=")) {