Hello,
I'm building a program that uses a WriteAllLines generic function:
private static void WriteAllLines(string file, string[] contents)
{
using (StreamWriter writer = new StreamWriter(file))
{
foreach (string line in contents)
{
writer.Write(line);
}
}
}
But the problem is that when I use it like this:
string temp = Path.GetTempFileName();
string file = ReadAllText(inputFile);
WriteAllLines(temp, value);
I know why this problem happens, it's because value
is a string and I'm putting it in a place of a string array(string[]
), but how I can change my code to solve this? Thanks.