Articles → .NET → Resolve classes conflict using global namespace qualifier in C#

Resolve classes conflict using global namespace

qualifier in C#







namespace Global_NameSpace_Qualifier
{
    class Program
    {
        static void Main(string[] args)
        {
           Program.GetMessage();
        }
    }
}


public class Program
{
    public static string GetMessage()
    {
        return "Hello";
    }
}







Global namespace qualifier for rescue




namespace Global_NameSpace_Qualifier
{
    class Program
    {
        static void Main(string[] args)
        {            
            string messge  = global::Program.GetMessage();
        }
    }
}
public class Program
{
    public static string GetMessage()
    {
        return "Hello";
    }
}





Posted By  -  Karan Gupta
 
Posted On  -  Friday, June 19, 2015

Query/Feedback


Your Email Id  
 
Subject 
 
Query/FeedbackCharacters remaining 250