【发布时间】:2012-06-14 19:42:28
【问题描述】:
如何从不同的类写入文件?
public class gen
{
public static string id;
public static string m_graph_file;
}
static void Main(string[] args)
{
gen.id = args[1];
gen.m_graph_file = @"msgrate_graph_" + gen.id + ".txt";
StreamWriter mgraph = new StreamWriter(gen.m_graph_file);
process();
}
public static void process()
{
<I need to write to mgraph here>
}
【问题讨论】:
-
你可以用 'n' 种方式来做...不要忘记以正确的方式来做...(请参阅我的建议;))
标签: c# class streamwriter