最佳答案
There exists a File.ReadAllLines
but not a Stream.ReadAllLines
.
using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("Test_Resources.Resources.Accounts.txt"))
using (StreamReader reader = new StreamReader(stream))
{
// Would prefer string[] result = reader.ReadAllLines();
string result = reader.ReadToEnd();
}
Does there exist a way to do this or do I have to manually loop through the file line by line?