Creating a StreamWriter object throws an error: "The type String could not be converted to type Stream"

I need to use a StreamWriter to write to a text file, but when I try to create one it throws this error:

Argument 1: cannot convert from 'string' to 'System.IO.Stream'

On MSDN, the StreamWriter class has constructors that take one Stream or one string. I don't know why I can't use the right constructor, but I need to know if I'm doing something wrong.

Here's the code in question:

using(StreamWriter outputFile = new StreamWriter("Output/" + name + "-Verbose" + ".txt")) 
{ 
    // do stuff 
}
Jon Skeet
people
quotationmark

I suspect you're writing a portable class library or something like that - if you look at the list of supported platforms in StreamWriter(String) it's considerably smaller than the list of supported platforms in StreamWriter(Stream). I suggest you just open a stream in whatever way is suitable for your target, and then wrap that in a StreamWriter.

people

See more on this question at Stackoverflow