D Dasawari

D Dasawari

  • NA
  • 138
  • 25.1k

I m new to c# and facing problem in own custom namespace .

May 8 2015 6:48 AM
Hi,
    I am new to C#  and I made own custom namespace lets say "namespace1" and referred in another namespace lets say "namespace2". When i run them , error comes like:
"Error 1 Program 'c:\c#_projects\namespace1\namespace1\obj\Debug\namespace1.exe' does not contain a static 'Main' method suitable for an entry point C:\c#_projects\namespace1\namespace1\CSC namespace1" .
 
 
Please rectify it.
 
 
 
Source Codes are given below:
 
1. namespace1 :
 
 
using System;


namespace namepspace1
{
class n1
{
public void Hello()
{
Console.WriteLine("Hello, C# World!");
}
}
 
 
 
 2. namespace2 : 
 
 
 using System;
using namespace1;

namespace namespace2
{
class n2
{
static void Main()
{
n1 cls = new n1();
cls.Hello();
}
}
}
 

Answers (1)