11
I need to read all the contents of a text file and put it into a string.
Usually, I do so:
using(var reader = new StreamReader("arquivo.txt"))
{
var strBuilder = new StringBuilder();
while (objReader.ReadLine() != null)
{
strBuilder.Append(objReader.ReadLine());
}
}
var texto = strBuilder.ToString();
Is there any other way or method that does this in a simpler way?
One day, when I go to study C#, I’ll remember that question :)
– Wallace Maxters