In C#, if I create a class with no namespace, what namespace will I use when trying to instantiate the class?
For example, assume main is...
namespace NamespaceTests
{
class Program
{
static void Main(string[] args)
{
}
}
}
... and assume my namespace-less class is ...
public class test
{
public string SayHello()
{
return "Hello World!";
}
}
... and assume I have another class by the same name, but having the default namespace...
namespace NamespaceTests
{
public class test
{
public string SayHello()
{
return "Hello Moon...";
}
}
}
... how would I modify main to include an instance of the namespace-less class and call 'SayHello' to retrieve the message "Hello World!"? Specifically, how would I fully qualify the namespace-less instance of class 'test', especially considering I may have another class also called 'test' but having a namespace, so I need to distinguish...
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…