c# read file stream
C#
using System;
using System.IO;
using System.Text;
namespace StreamReaderReadToEnd
{
class Program
{
static void Main(string[] args)
{
var path = @"C:\Users\Jano\Documents\thermopylae.txt";
using var fs = new FileStream(path, FileMode.Open, FileAccess.Read);
using var sr = new StreamReader(fs, Encoding.UTF8);
string content = sr.ReadToEnd();
Console.WriteLine(content);
}
}
}//this will get a string with all the text from the file
var fileText = File.ReadAllText(@"path\to\my\file.txt");
//this will get all of the lines of the file as an string[]
var fileLines = File.ReadAllLines(@"path\to\my\file.txt");
Also in C#:
- Title
- c# read file stream
- Category
- C#
- Title
- exit game unity
- Category
- C#
- Title
- c# expression func automatically select return type
- Category
- C#
- Title
- set label position winforms
- Category
- C#
- Title
- how to import datagridview to datatable in c#
- Category
- C#
- Title
- what is using static in c#
- Category
- C#
- Title
- linq c# or
- Category
- C#
- Title
- eager loading vs lazy loading c#
- Category
- C#
- Title
- .net identity seed users and roles
- Category
- C#
- Title
- how to add to an array c#
- Category
- C#
- Title
- c# unity rotate first person controller script
- Category
- C#
- Title
- c# bitmap to Image
- Category
- C#
- Title
- C# sprint key
- Category
- C#
- Title
- c# string list contains
- Category
- C#
- Title
- if get key down unity
- Category
- C#
- Title
- split on uppercase c#
- Category
- C#
- Title
- player script unity
- Category
- C#
- Title
- dto and automapper
- Category
- C#
- Title
- webclient c# example post
- Category
- C#
- Title
- how to make a game
- Category
- C#
- Title
- c# expandoobject indexer
- Category
- C#
- Title
- asp textarea
- Category
- C#
- Title
- c# how to refresh your binding source
- Category
- C#
- Title
- c# docstring
- Category
- C#
- Title
- c# get foreground window
- Category
- C#
- Title
- visual studio C# hintergrund bild ändern
- Category
- C#
- Title
- foreach syntax c#
- Category
- C#
- Title
- define enum c#
- Category
- C#
- Title
- c# get the last item in a list
- Category
- C#
- Title
- unity scene name get
- Category
- C#
- Title
- get type of variable c#
- Category
- C#
- Title
- unity detect number key
- Category
- C#
- Title
- c# superclass constructor
- Category
- C#
- Title
- how to find the type of a object c#
- Category
- C#
- Title
- get set c#
- Category
- C#
- Title
- c# new dictionary linq
- Category
- C#
- Title
- edit form item from class C#
- Category
- C#
- Title
- c# char array to string
- Category
- C#
- Title
- c# reverse a string
- Category
- C#
- Title
- arry in c#
- Category
- C#
- Title
- defualtsize UWP c#
- Category
- C#
- Title
- unity indestructible
- Category
- C#
- Title
- access dic by key c#
- Category
- C#
- Title
- open udp socket c#
- Category
- C#
- Title
- c# unhandled exception in thread
- Category
- C#
- Title
- c# get enum in list
- Category
- C#
- Title
- isInstanceOf nunit
- Category
- C#
- Title
- unity how to get y value
- Category
- C#
- Title
- c# function return
- Category
- C#
- Title
- using serial port in c#
- Category
- C#
- Title
- wpf c# select folder path
- Category
- C#
- Title
- C# loop through array of objet
- Category
- C#
- Title
- c# try catch error
- Category
- C#
- Title
- how to insert <input> datatype <td> in asp.net core table
- Category
- C#
- Title
- c# format number with leading zeros
- Category
- C#
- Title
- grab reference from method parameter c#
- Category
- C#
- Title
- unity prevent system from creation
- Category
- C#
- Title
- void Update
- Category
- C#
- Title
- whats a string
- Category
- C#
- Title
- c# lambda expression
- Category
- C#
- Title
- unity line renderer position count
- Category
- C#
- Title
- c# remove specific character from string
- Category
- C#
- Title
- convert array to list Unity C#
- Category
- C#
- Title
- how to declare 2d array in c#
- Category
- C#
- Title
- c# get list of all class fields
- Category
- C#
- Title
- blazor wasm routable page in separate project
- Category
- C#
- Title
- pop up element from specific index in array
- Category
- C#
- Title
- Unity if object doens't exist
- Category
- C#
- Title
- unity vector3 to array
- Category
- C#
- Title
- c# get every point in a line in matrix
- Category
- C#
- Title
- unity get velocity at point
- Category
- C#
- Title
- error CS0542
- Category
- C#
- Title
- c# if statement
- Category
- C#
- Title
- xamarin hide back button
- Category
- C#
- Title
- c# push numbers to array
- Category
- C#
- Title
- how to reduce garbage collection c#
- Category
- C#
- Title
- decimals not stored in azure tables
- Category
- C#
- Title
- c# how to use inovke
- Category
- C#
- Title
- change Backcolor c#
- Category
- C#
- Title
- remove items from list c# condition
- Category
- C#
- Title
- how to load the active scene unity
- Category
- C#
- Title
- c# resize bitmap
- Category
- C#
- Title
- c# odd even median
- Category
- C#
- Title
- open file in explorer c#
- Category
- C#
- Title
- c# windows grab screenshot
- Category
- C#
- Title
- c# quick "is" "as"
- Category
- C#
- Title
- check if enabled unity
- Category
- C#
- Title
- C# public 2d array
- Category
- C#
- Title
- c# contextswitchdeadlock
- Category
- C#
- Title
- autofixture ignore property
- Category
- C#
- Title
- find negative version of integer in c#
- Category
- C#
- Title
- c# generate random number
- Category
- C#
- Title
- c# replace foreach with lambda
- Category
- C#
- Title
- c# object to json string
- Category
- C#
- Title
- how to reference the position of a game object unity
- Category
- C#
- Title
- unity image
- Category
- C#
- Title
- generate a dropdown list from array data using razor .net mvc
- Category
- C#
- Title
- c# get full URL of page
- Category
- C#
- Title
- c# warning CS0108
- Category
- C#
- Title
- what type of variable is true or false in c#
- Category
- C#