Is there a way to map all the empty fields inside .csv file as NULL using Microsoft.VisualBasic.FileIO's TextFieldParser

I am working on a C# console application. and I am reading a .csv file using Microsoft.VisualBasic.FileIO package. as follow:-

class Program
{
    static void Main(string[] args)
    {
        Entities entities = new Entities();
        TextFieldParser parser = new TextFieldParser(@"C:\My.csv");

        parser.TextFieldType = FieldType.Delimited;
        parser.SetDelimiters(",");
        while (!parser.EndOfData)
        {
            string[] fields = parser.ReadFields();

Can I define to map any empty .csv cell as NULL? For example, currently I can trim all the values doing specifying this:

parser.TrimWhiteSpace = true;

Can I set the parser to map any empty cell as Null?

Thanks

Answers


as per @Hans answer No, turning empty strings into NULL is your job. – Hans Passant yesterday


Need Your Help

Category and subcateory in nodejs and mongodb

node.js mongodb

I want to build a Category and Subcategory feature in MEAN application.

Python Peer-to-Peer Chat (Sockets)

python sockets

I've been tasked with creating a peer-to-peer chat application, but I'm having trouble actually sending messages.