I need to read the entire contents of a text file and put it in a string .
Generally, I do this:
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 another way or method that does this in a simpler way?