I am using LINQtoCsv (Info here), and have hit a snag.
I have an IEnumerable set up like that page says: IEnumerable<Character> characters = cc.Read<Character>(file, inputFileDescription);
What I don't know how to do is go from the IEnumerable, to something that will show on the datagridview. I have never used LINQ or IEnumerable before, so sorry if this seems a little stupid.
My code is near identical (names are different obviously) to the way the examples are on the site, so it would be easiest to just pretend that those examples are my code.
I suspect it's as simple as setting the DataSource
:
view.DataSource = characters;
Depending on what LINQ to CSV does, you may want to pull everything into a List<T>
first:
var characters = cc.Read<Character>(file, inputFileDescription).ToList();
view.DataSource = characters;
You'll probably want to set the columns etc directly, overriding the descriptive heading etc. Follow the documentation link for lots of examples etc.
See more on this question at Stackoverflow