[ACCEPTED]-Why does Console.Out.WriteLine exist?-reflector
Console.WriteLine
is a static method. Console.Out
is a static object 8 that can get passed as a parameter to any 7 method that takes a TextWriter
, and that method could 6 call the non-static member method WriteLine
.
An example 5 where this would be useful is some sort 4 of customizable logging routines, where 3 you might want to send the output to stdout
(Console.Out
), stderr
(Console.Error
) or 2 nowhere (System.IO.TextWriter.Null
), or anything else based on some 1 runtime condition.
Brad Abrams (The founding member of both CLR and .NET 2 framework at Microsoft) says the following.
Console.WriteLine() is simply a shortcut for Console.Out.WriteLine. Console was overloaded by WriteLine propery to make that much easier to write.
Source: Book 1 "The C# Programming Language by Anders Hejlsberg".
More Related questions
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.