We've now made an updated video that addresses some of your questions about handling semicolon delimiters and CSV files with no header row, check it out! kzbin.info/www/bejne/nGbFq4GebM2Jns0
@kelvindai19942 жыл бұрын
Hi, i have a few question ?! 1. Let's say i have an Child Class named Fuel of RocketInfo ( Fuel : RocketInfo ), how do i write it to a csv file along side with the parent class ( RocketInfo ) ? 2. How do i read multiple .csv files in the same folder ?
@husseinadam4724 Жыл бұрын
I am really liking this channel thank you Robert
@RDT Жыл бұрын
Thanks for your support
@AlbrechtJ3 жыл бұрын
Your example is awesome. Thanks for the CsvHelper series.
@RDT3 жыл бұрын
You’re welcome, glad you enjoyed it! I really like the library
@gatocode3164 ай бұрын
simple and direct, thanks.
@RDT4 ай бұрын
You're welcome!
@kopilkaiser89912 жыл бұрын
Thanks for the video. I really pretty much understood everything you had shown and demonstrated.
@joffrelustosadoamaralmota61852 жыл бұрын
Nice! An idea for some other video, is showing how to work with both mapped and dynamic columns.
@sofianell25573 жыл бұрын
Hello, please where does the newly created file goes ? Evrything compile OK, but i cannot find the file Thx
@patrickboehme45562 жыл бұрын
Awesome video, thanks!
@RDT2 жыл бұрын
Glad to hear you enjoyed it 😊
@badrulhussain55453 жыл бұрын
Hi is there a way to update the Environment.CurrentDirectory path. For example, if you have 3 projects in one solution and the 3rd project is a repository and you want the file to be saved in that 3rd project folder then the main project 1 that has the Controller?
@RDT3 жыл бұрын
Hi Badrul, I just used the Environment.CurrentDirectory as an example to keep things simple, but if you had multiple projects perhaps you could use a ..\ to switch between folders e.g. $"{Environment.CurrentDirectory}..\RepositoryProject"
@jamesallgood85063 жыл бұрын
nice video. is there any way to sort the column heads vertically instead of the default horizontal line? I cant seem to figure it out
@RDT3 жыл бұрын
As far as I can see, CsvHelper will always write column headers to the first line. However it does support writing dynamic/ExpandoObjects so you might be able to do something with that? You could create an IEnumerable populated with dynamically created objects that have the "column" name as the first property, and then add the other properties from your object after. That way the column names will be down the left hand side when you open up the file. If you then set the HasHeaderRecord = false on CsvConfiguration then it won't try to write a header line for you. Be careful when calling WriteRecords, make sure the type T on the IEnumerable is dynamic and not ExpandoObject, as it'll throw an exception. Hope that helps? Glad you enjoyed the video!
@jamesallgood85063 жыл бұрын
@@RDT Nvm, the PO just changed the requirment as of today, so I am good with the normal layout. But thanks a lot, anyway :)
@indreeshpandey20252 жыл бұрын
hi, can u please make a video on state pattern ex like stopwatch
@harveyemmerson15682 жыл бұрын
Is there a way to target specific cells, i am creating a little finance program and i need to change the users balance that is stored within the CSV file, is there a way i can target just that specific cells when writing records?
@egorzh38283 жыл бұрын
Hi, please tell me how to change the delimiter?
@RDT3 жыл бұрын
Hi EgorZH, thanks for your comment. You can change the delimiter by creating a new CsvConfiguration object and setting the Delimiter property, then passing that into the CsvWriter constructor instead of CultureInfo. I'll be uploading a new video soon which addresses this and a few other viewer questions :)
@egorzh38283 жыл бұрын
@@RDT Thanks
@AeroTesting Жыл бұрын
Hi you can help me! i'm trying save .csv but first i Open .DAT File -> .csv save format! can you help?
@indreeshpandey20252 жыл бұрын
hi, can u please tell how to find the average of the payload capacity?
@RDT2 жыл бұрын
You could use the built in .NET Linq methods. Select to get an enumerable of the Payload capacity column and then Enumerable.Average
@favela93483 жыл бұрын
Hello, Thanks for the video, I have a problem with this line " return rocket.PayloadCapacity.HasValue ? $"{rocket.PayloadCapacity} kg" : String.Empty; " I don't know why I have this error : CS1061 'ConvertToStringArgs ' does not contain a definition for 'PayloadCapacity' and no accessible extension method 'PayloadCapacity' accepting a first argument of type 'ConvertToStringArgs ' was not found (a using directive or a reference assembly missing?) Can you help me :) Thanks
@favela93483 жыл бұрын
And it's possible to display an array ?
@PaoloBoffi3 жыл бұрын
Hi, I don't know why but even following all the steps you have made my data are all inside the first element of the row in the .csv file, and not one for each column as in your example. Could you please help me?
@RDT3 жыл бұрын
Hi Paolo, is your source file formatted OK? Are you using dynamics or a custom class with attributes/classmap?
@PaoloBoffi3 жыл бұрын
@@RDT hi, I managed yo solve. It was a problem with Excel, that I used to open the .csv file. It saw ";" as delimitation and not ","
@RDT3 жыл бұрын
That’s great, happy to hear you got it sorted. You can also set the delimiter CsvHelper uses in Configuration
@PaoloBoffi3 жыл бұрын
@@RDT thank you again for your help :) And thank you for your videos :)
@RDT3 жыл бұрын
You’re welcome!
@cirilla72833 жыл бұрын
thanks
@RDT3 жыл бұрын
You're welcome!
@willchen58952 жыл бұрын
is this .net 5.0 ?
@RDT2 жыл бұрын
This example was 3.1 github.com/chrismroberts/csvwriter-example/blob/main/CsvWriterDemo.csproj