Hi all,
I am new to C# and i am learning it from home.. so my doubts may seem silly to some of you:( .
I am posting here to find some help fr the errors i get..
I am practising namespaces and i keep getting this error when i compile it in the DOS mode.
Any help is appreciated.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace nov8prac1
{
class Program
{
static void Main()
{
//classinprac1 a = new classinprac1 ();
nov8prac1.classinprac1.classinprac2( );
Console.WriteLine("Enter you age");
int age = Convert.ToInt16(Console.ReadLine());
if (age < 18)
{
Console.WriteLine("You may not enter");
}
else
{
Console.WriteLine("Enter your name ");
string name = Console.ReadLine();
Console.WriteLine("Welcome {0}", name);
}
}
}
}
In the same namespace but in different file i created another class as following:
filename: classinprac1.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace nov8prac1
{
class classinprac1
{
public static void classinprac2( )
{
Console.WriteLine("control has come to the class now");
//Console.WriteLine("return value from the main method to the class is {0}", abc);
}
}
}
Errors I am getting in DOS mode are:
error cs0234:The type or namespacename 'classinprac1' does not exist in the namespace 'nov8prac1' (are you missing an assembly reference?)