DEV Community

Discussion on: How to write to a file with C# - StackOverflow doesn't get it right

Collapse
 
bekzat_karayev profile image
Bekzat Karayev

Interesting article! I liked exception handling part, it is a thing that I often forget when writing my code, then I wonder "what's gone wrong")
Could you share some real cases from your own developer experience, where you needed to add huge amount of text to a file?

Collapse
 
thomasardal profile image
Thomas Ardal

Thanks. The only thing I can think of right now is described here: blog.elmah.io/csharp-exception-han.... Anything you are looking for in particular?

Collapse
 
dsqrt4 profile image
dsqrt4

Imports and exports from/to enterprise systems are a quite common use case that may require writing large text files.

Say you have separate point of sale and ERP or accounting software, then it’s common that these systems provide some means to dump product details or load transactions in the form of CSV or fixed with text files.

Either one side of these systems provides a proper API for you to retrieve data, which you can then write to a file that is understood by the other system, or you’ll have the joy of loading one exported text file and mapping it to the other systems import format.

Collapse
 
bekzat_karayev profile image
Bekzat Karayev

I see, thanks for the answer.