Error CS0246

L

Leo

Hi,

The code below is working:

Main.cs
-------------

using System;

namespace test3
{
class zzz
{
public static void main()
{
vijay.yyy.abc();
}
{
}

namespace vijay
{
class yyy
{
public static void abc()
{
System.Console.Writeline("abc");
}
}
}

I want to put the namespace vijay in another document. The code will be:

Main.cs
-------------

using System;
using vijay;

namespace test3
{
class zzz
{
public static void main()
{
vijay.yyy.abc();
}
{
}

yyy.cs (the other document)
-----------
using System;

namespace vijay
{
class yyy
{
public static void abc()
{
System.Console.Writeline("abc");
}
}
}

I'am getting the following error:

The type or namespace "vijay" could not be found (are you missing a using
directive
or an assembly reference (CS0246)).
I think it is the assembly reference.If it is so how do i change that.


Thanks in advance.

Leo
 
J

Jon Skeet [C# MVP]

[There's no need to post the same question four times, by the way...]

Leo said:
The code below is working:

I want to put the namespace vijay in another document. The code will be:

<snip>

Well, no it won't, quite. You haven't posted code that even *should*
work:

1) Main needs to be capitalised for it to be the default entry point
2) You've got one of your braces the wrong way round
3) You've called Console.Writeline instead of Console.WriteLine

It's *very* important to cut and paste *actual code* rather than just
typing something which approximates to it. It doesn't need to be code

I'am getting the following error:

The type or namespace "vijay" could not be found (are you missing a using
directive
or an assembly reference (CS0246)).
I think it is the assembly reference.If it is so how do i change that.

It would only be a missing assembly reference if the two files were in
different projects. Are they?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top