Skip to content

Throw TypeConverterException from custom TypeConverter #2282

Answered by AltruCoder
Transzendental asked this question in Q&A
Discussion options

You must be logged in to vote

You should be able to use row.Context

_ => throw new TypeConverterException(this, memberMapData, text, row.Context),

Your other option would be to use TypeConverterOptionsCache instead of the VpBoolCsvConverter

csv.Context.TypeConverterOptionsCache.GetOptions<bool>().BooleanTrueValues.Add("Ja");
csv.Context.TypeConverterOptionsCache.GetOptions<bool>().BooleanFalseValues.Add("Nein");
csv.Context.TypeConverterOptionsCache.GetOptions<bool>().BooleanFalseValues.Add("");

Replies: 1 comment 1 reply

Comment options

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

Answer selected by Transzendental
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