c# - Why is this an incorrect usage of a namespace? -
i'm learning c#, i'm not quite sure namespaces. know leave off "using" statements, , system.console.writeline, or "using system" , "console.writeline", not understand why following doesn't work.
using system.console; namespace helloworld { public class program { public static void main(string[] args) { writeline("hello world"); } } }
console
not namespace, class. writeline
static method of class (so don't need instance use it). in fact, console
class appears static (so there no instances).
you cannot using
class in c# 5.0 , earlier. according msdn article (http://msdn.microsoft.com/en-us/magazine/dn683793.aspx) can static classes in c# 6.0 (the code wrote compile , work).
msdn console
class.
Comments
Post a Comment