Skip to content

Initialize DTO properties with default value or null. #123

Answered by SteveLemire
SteveLemire asked this question in Q&A
Discussion options

You must be logged in to vote

Thanks!!! I found the GetExcelDataType in your source code so I did exactly what you suggested:

        public object GetCellData(int columnIndex)
        {
            if (this.isCsvDataReader)
            {
                return this.csvReader[columnIndex];
            }

            var cellType = this.excelReader.GetExcelDataType(columnIndex);
            switch (cellType)
            {
                case ExcelDataType.Numeric:
                case ExcelDataType.DateTime:
                case ExcelDataType.String:
                case ExcelDataType.Boolean:
                    return this.excelReader[columnIndex];
                case ExcelDataType.Error:
                    return…

Replies: 3 comments 5 replies

Comment options

You must be logged in to vote
4 replies
@SteveLemire
Comment options

@MarkPflug
Comment options

@SteveLemire
Comment options

@MarkPflug
Comment options

Comment options

You must be logged in to vote
1 reply
@MarkPflug
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by SteveLemire
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants