OutputToConsole
以下のブール値を検討してくださいclass
。
次の 2 行のコードに違いはありますか?
private static bool OutputToConsole = true;
static bool OutputToConsole = true;
どちらも同じように機能するようです。
class Debug
{
private static bool OutputToConsole = true;
public static void Log(string Type, string URL, StringBuilder Parameters)
{
Write(Type + ":" + new string(' ', 9 - Type.Length) + URL + " { " +
Parameters.ToString() + " }");
}
public static void Log(string Data)
{
Write("Response: " + Data);
}
private static void Write(string Output)
{
Trace.WriteLine(Output);
if(OutputToConsole) Console.WriteLine(Output);
}
}