我有这堂课:
public static class CsvWriter
{
private static StreamWriter _writer = new StreamWriter(@"c:\temp\ssis_list.csv");
public static StreamWriter Writer
{
get { return _writer; }
}
}
这是从另一个类
调用的 class Program
{
...
static void GetConnections(string path,string pkgname,string server)
{
_writer.WriteLine(myLine);
}
}
出现此错误
The name '_writer' does not exist in the current context
我该如何解决这个问题?
答案 0 :(得分:11)
您想要CsvWriter.Writer.WriteLine
。