Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to read/write files in .Net Core?

What are the options to read/write files in .Net Core?

I am working on my first .Net Core app and looking for File.Read*/File.Write* functions (System.IO from .Net) alternatives.

like image 968
Ankit Avatar asked Jan 17 '17 15:01

Ankit


People also ask

How do I use .NET core files?

How to upload and download files in ASP.NET Core MVC. In an empty project, update the Startup class to add services and middleware for MVC. Add a Controller and action methods to upload and download the file. Add a Razor page with HTML form to upload a file.

How do I open a text file in Visual Studio?

Start Visual Studio. On the File menu, point to New, and then click Project. Click Visual C# Projects under Project Types, and then click Console Application under Templates. On the Debug menu, select Start to compile and to run the application.


1 Answers

Package: System.IO.FileSystem

System.IO.File.ReadAllText("MyTextFile.txt"); ? 
like image 62
Leszek P Avatar answered Sep 24 '22 18:09

Leszek P