I have this class:
public static class CsvWriter
{
private static StreamWriter _writer = new StreamWriter(@"c:\temp\ssis_list.csv");
public static StreamWriter Writer
{
get { return _writer; }
开发者_开发百科 }
}
This is being called from another class
class Program
{
...
static void GetConnections(string path,string pkgname,string server)
{
_writer.WriteLine(myLine);
}
}
Which has this error
The name '_writer' does not exist in the current context
How can I fix this?
You want CsvWriter.Writer.WriteLine
.
精彩评论