FileHelpers 라이브러리를 사용할 때 .csv 파일을 쓰려고 할 때 NullReferenceException이 발생합니다.Filehelpers null 십진수 값을 쓰려고 할 때 NullReferenceException
나는 문제를 줄였습니다. 내가 십진수를 가질 때마다? 이 예외를 throw합니다. 독서에서는 잘 작동하지만 쓰지는 않습니다.
내 응용 프로그램과 같은 문제를 보여주는 샘플 포함했다 :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication11
{
class Program
{
static void Main(string[] args) {
rec record = new rec { id = 1, mydecimal = null };
List<rec> records = new List<rec> { record };
FileHelpers.FileHelperEngine<rec> engine = new FileHelpers.FileHelperEngine<rec>();
Console.WriteLine(engine.WriteString(records));
}
}
[FileHelpers.DelimitedRecord(",")]
public class rec
{
public int id;
public decimal? mydecimal;
}
}
NULL이는 아무 문제가 없을 것이라는 패키지에서 NuGet에서 그러나 사용할 수 있습니다. http://www.filehelpers.com/example_nullable.html –
내가 사용하는 버전은 2.0.0.0이며 nuget에서 제공됩니다. 이것은 최신 버전 인 것 같습니다. 위의 코드는 예외를 throw합니다. 전체 프로젝트를 github에 올렸지 만 vs2010 솔루션/프로젝트에 래핑 된 내용은 다음과 같습니다. https://github.com/estubbs/Stack-overflow-fh-questions – Erick