-2

I have a solution with several projects

At first, the Assembly name = B, Default namespace = B In the source code, i define some class with Namespace B.C. No Compilation error

Now I change all Assembly Name from B to A, and default namespace remains as B

Then i get compilation error, it is said that due to the protection level

Any idea about this ?

dove
  • 20,469
  • 14
  • 82
  • 108
  • 3
    You really need to be more specific. There's obviously been some other change as well. Post some code. Specifically, maybe the line that gives the error, and the definition for the class? – J. Steen Sep 12 '12 at 12:55
  • Make stuff `public` and errors will go away. Or, change the default namespace from `B` to `A`. – Alex Sep 12 '12 at 13:08

1 Answers1

0

Most likely you omitted class visibility identifiers (you know, all those public, protected and private stuff). By default, if I'm not mistaking, if you omit class visibility declaration, C# assumes it's internal (and there's a good question on SO about it), so it's not visible to your calling method.

The simpliest way is to explicitly mark those class as public, e.g.

public class YOURCLASSNAME {
     //other stuff you have
}

But you should consider if it makes sense in your case to make the class public. Encapsulation OOP principle means (to some extent) that you must avoid declaring everything public.

Anyway, some code samples could make this question an answerable question. Now it's just guessing and psychic debugging.

Community
  • 1
  • 1
J0HN
  • 26,063
  • 5
  • 54
  • 85