G
Guest
I have the following code. bit it gives me error that The best overload
method for string.Split(params char[]) has some invalid arguments. I am
using stringbuilder which doesn't have split method so how can I do that.
public static string[] ReadFileLines(string path)
{
int read = 0;
StringBuilder builder = new StringBuilder();
byte[] buffer = new byte[1024];
using (FileStream readStream = File.Open(path, FileMode.Open,
FileAccess.Read, FileShare.Read))
{
while ((read = readStream.Read(buffer, 0, buffer.Length)) > 0)
builder.Append(Encoding.UTF8.GetString(buffer, 0, read));
}
return String.Split(builder.ToString(), "\r\n");
}
method for string.Split(params char[]) has some invalid arguments. I am
using stringbuilder which doesn't have split method so how can I do that.
public static string[] ReadFileLines(string path)
{
int read = 0;
StringBuilder builder = new StringBuilder();
byte[] buffer = new byte[1024];
using (FileStream readStream = File.Open(path, FileMode.Open,
FileAccess.Read, FileShare.Read))
{
while ((read = readStream.Read(buffer, 0, buffer.Length)) > 0)
builder.Append(Encoding.UTF8.GetString(buffer, 0, read));
}
return String.Split(builder.ToString(), "\r\n");
}