C# Data Access: Text Files

IAmTimCorey · 275K views · 2016 · 24:34

Open on YouTube

Software practice, open source & careersPython, Ruby & scripting languagestutorial

Why Stack Overflow recommends it

Stack Overflow users link it when pointing newcomers to a simple, practical walkthrough of C# text file input and output.

Recommended by 1 people across 1 different months, 2017 to 2020.

What it is

A beginner-friendly tutorial by IAmTimCorey on reading from and writing to plain text files in C# using a console app. It covers file paths, reading lines, splitting lines into data model fields, string interpolation, and writing a list of objects back to a file.

What people said

Recommends Harag · 2017-01 · Stack Overflow · on “how to store and retrieve list elements added by winform c# button?”

You need to write out the list box data to something, e.g. text file, database when the application closes, and load it in when you run the application - Look up how to write text files - here is a good vid tutorial to get you started. [this video]

Cites Hamilton norris · 2019-05 · Stack Overflow · on “Getting stuck with a few things with this code”

Greeting. I am new to coding so these problems I am facing might be quite easy for some of you. I am trying to make a simple tool that takes an exported file and read the price data in the file. but first I need to be able to import the file that is currently in \Marketlogs. All of the files are .txt. I have gotten it to work off a set name but I have not found a way to import an unknown name. here is an example of a file name it might pull "Esoteria-Liquid Ozone-2019.05.04 015804" I have been following along with IAmTimCorey youtube videos for the basic idea how to read the files but he is using a fixed file name for his videos [this video] [LINK] using System; using System.Collections.Generic;

Cites Atul Chinchalkar · 2020-09 · Stack Overflow · on “C# How to delete certain rows from a CSV file and save it as a new CSV using CsvHelper?”

There are too many ways of doing this not specifically using CsvHelper, hence i'm listing few suggestions you can try Simplest solution without getting into details, if the file is small enough(in MBs), read all lines into a List or IEnumerable and then you can do any operation on that collection and write the collection back to the file. if you are new to c# try out all basic file operations before working on the actual project . Follow a tutorial such as [LINK] or videos on youtube Text Files : [this video] File IO : [LINK] Use free tools like LinqPad or dotnetfiddle to try small code snippets before writing a large program. once you are comfortable working with files using .Net libraries, you