Can't access other public classes in the same namespace
up vote
0
down vote
favorite
I have a few classes in a namespace called Mafia. Every cs file in the picture follows this structure:
namespace Mafia {
public class Name {
}
}
And the file name matches the class name.

I can access all classes in EvenEmitter, NightAction, Player, Role, Roles, Settings, Win and ActionManager.
I can access Game, NightAction and PhaseManager from every other class as well, but I can't access any classes in Game, NightAction and PhaseManager.
(This is in Player.cs VVV)

You can see, I cannot access Game, NightAction and PhaseManager from the Mafia namespace, but I can access them like they aren't in a namespace. When I hover over them I get just class Game / NightAction / PhaseManager, not class Mafia. Game for example.
(This is in Game.cs VVV)

(Same thing happens in NightAction and PhaseManager).
So in short, I have a lot of classes in a single namespace. However, 3 of them are acting like they aren't in a namespace.
Some things I did before the problem occurred:
- I renamed the folder, then noticed the problem and renamed it back.
For those who say that I forgot to public them:



c#
|
show 2 more comments
up vote
0
down vote
favorite
I have a few classes in a namespace called Mafia. Every cs file in the picture follows this structure:
namespace Mafia {
public class Name {
}
}
And the file name matches the class name.

I can access all classes in EvenEmitter, NightAction, Player, Role, Roles, Settings, Win and ActionManager.
I can access Game, NightAction and PhaseManager from every other class as well, but I can't access any classes in Game, NightAction and PhaseManager.
(This is in Player.cs VVV)

You can see, I cannot access Game, NightAction and PhaseManager from the Mafia namespace, but I can access them like they aren't in a namespace. When I hover over them I get just class Game / NightAction / PhaseManager, not class Mafia. Game for example.
(This is in Game.cs VVV)

(Same thing happens in NightAction and PhaseManager).
So in short, I have a lot of classes in a single namespace. However, 3 of them are acting like they aren't in a namespace.
Some things I did before the problem occurred:
- I renamed the folder, then noticed the problem and renamed it back.
For those who say that I forgot to public them:



c#
1
Please share your other classes code which you can't access also. I guess you forgot to public these classes.
– Nhan Phan
Nov 9 at 7:48
1
@Nhan Based on "but I can access them like they aren't in a namespace" it sounds more like OP has removed the namespace declaration from around them, or they're actually in the same namespace as the code where OP is using them.
– John
Nov 9 at 7:49
OP, please provide examples of these classes in your question, including their namespaces, etc.
– John
Nov 9 at 7:50
1
Namespaces are not folders. Don't look at the folder structure; look at the namespace declarations for each class.Or use Visual Studio's Object Browser (on the View menu) and do a search for your class; it might not be where you think it is.
– John Wu
Nov 9 at 7:50
@John added pictures.
– Mxm
Nov 9 at 7:55
|
show 2 more comments
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have a few classes in a namespace called Mafia. Every cs file in the picture follows this structure:
namespace Mafia {
public class Name {
}
}
And the file name matches the class name.

I can access all classes in EvenEmitter, NightAction, Player, Role, Roles, Settings, Win and ActionManager.
I can access Game, NightAction and PhaseManager from every other class as well, but I can't access any classes in Game, NightAction and PhaseManager.
(This is in Player.cs VVV)

You can see, I cannot access Game, NightAction and PhaseManager from the Mafia namespace, but I can access them like they aren't in a namespace. When I hover over them I get just class Game / NightAction / PhaseManager, not class Mafia. Game for example.
(This is in Game.cs VVV)

(Same thing happens in NightAction and PhaseManager).
So in short, I have a lot of classes in a single namespace. However, 3 of them are acting like they aren't in a namespace.
Some things I did before the problem occurred:
- I renamed the folder, then noticed the problem and renamed it back.
For those who say that I forgot to public them:



c#
I have a few classes in a namespace called Mafia. Every cs file in the picture follows this structure:
namespace Mafia {
public class Name {
}
}
And the file name matches the class name.

I can access all classes in EvenEmitter, NightAction, Player, Role, Roles, Settings, Win and ActionManager.
I can access Game, NightAction and PhaseManager from every other class as well, but I can't access any classes in Game, NightAction and PhaseManager.
(This is in Player.cs VVV)

You can see, I cannot access Game, NightAction and PhaseManager from the Mafia namespace, but I can access them like they aren't in a namespace. When I hover over them I get just class Game / NightAction / PhaseManager, not class Mafia. Game for example.
(This is in Game.cs VVV)

(Same thing happens in NightAction and PhaseManager).
So in short, I have a lot of classes in a single namespace. However, 3 of them are acting like they aren't in a namespace.
Some things I did before the problem occurred:
- I renamed the folder, then noticed the problem and renamed it back.
For those who say that I forgot to public them:



c#
c#
edited Nov 9 at 7:51
asked Nov 9 at 7:41
Mxm
237
237
1
Please share your other classes code which you can't access also. I guess you forgot to public these classes.
– Nhan Phan
Nov 9 at 7:48
1
@Nhan Based on "but I can access them like they aren't in a namespace" it sounds more like OP has removed the namespace declaration from around them, or they're actually in the same namespace as the code where OP is using them.
– John
Nov 9 at 7:49
OP, please provide examples of these classes in your question, including their namespaces, etc.
– John
Nov 9 at 7:50
1
Namespaces are not folders. Don't look at the folder structure; look at the namespace declarations for each class.Or use Visual Studio's Object Browser (on the View menu) and do a search for your class; it might not be where you think it is.
– John Wu
Nov 9 at 7:50
@John added pictures.
– Mxm
Nov 9 at 7:55
|
show 2 more comments
1
Please share your other classes code which you can't access also. I guess you forgot to public these classes.
– Nhan Phan
Nov 9 at 7:48
1
@Nhan Based on "but I can access them like they aren't in a namespace" it sounds more like OP has removed the namespace declaration from around them, or they're actually in the same namespace as the code where OP is using them.
– John
Nov 9 at 7:49
OP, please provide examples of these classes in your question, including their namespaces, etc.
– John
Nov 9 at 7:50
1
Namespaces are not folders. Don't look at the folder structure; look at the namespace declarations for each class.Or use Visual Studio's Object Browser (on the View menu) and do a search for your class; it might not be where you think it is.
– John Wu
Nov 9 at 7:50
@John added pictures.
– Mxm
Nov 9 at 7:55
1
1
Please share your other classes code which you can't access also. I guess you forgot to public these classes.
– Nhan Phan
Nov 9 at 7:48
Please share your other classes code which you can't access also. I guess you forgot to public these classes.
– Nhan Phan
Nov 9 at 7:48
1
1
@Nhan Based on "but I can access them like they aren't in a namespace" it sounds more like OP has removed the namespace declaration from around them, or they're actually in the same namespace as the code where OP is using them.
– John
Nov 9 at 7:49
@Nhan Based on "but I can access them like they aren't in a namespace" it sounds more like OP has removed the namespace declaration from around them, or they're actually in the same namespace as the code where OP is using them.
– John
Nov 9 at 7:49
OP, please provide examples of these classes in your question, including their namespaces, etc.
– John
Nov 9 at 7:50
OP, please provide examples of these classes in your question, including their namespaces, etc.
– John
Nov 9 at 7:50
1
1
Namespaces are not folders. Don't look at the folder structure; look at the namespace declarations for each class.Or use Visual Studio's Object Browser (on the View menu) and do a search for your class; it might not be where you think it is.
– John Wu
Nov 9 at 7:50
Namespaces are not folders. Don't look at the folder structure; look at the namespace declarations for each class.Or use Visual Studio's Object Browser (on the View menu) and do a search for your class; it might not be where you think it is.
– John Wu
Nov 9 at 7:50
@John added pictures.
– Mxm
Nov 9 at 7:55
@John added pictures.
– Mxm
Nov 9 at 7:55
|
show 2 more comments
1 Answer
1
active
oldest
votes
up vote
0
down vote
Weird. I deleted the project from the solution then added it back and everything was fixed. Welp, thanks for the help anyways!
You maybe just lost Visual studio by renaming folders. Sometime restarting VS is enough.
– Grégory L
Nov 9 at 8:33
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
Weird. I deleted the project from the solution then added it back and everything was fixed. Welp, thanks for the help anyways!
You maybe just lost Visual studio by renaming folders. Sometime restarting VS is enough.
– Grégory L
Nov 9 at 8:33
add a comment |
up vote
0
down vote
Weird. I deleted the project from the solution then added it back and everything was fixed. Welp, thanks for the help anyways!
You maybe just lost Visual studio by renaming folders. Sometime restarting VS is enough.
– Grégory L
Nov 9 at 8:33
add a comment |
up vote
0
down vote
up vote
0
down vote
Weird. I deleted the project from the solution then added it back and everything was fixed. Welp, thanks for the help anyways!
Weird. I deleted the project from the solution then added it back and everything was fixed. Welp, thanks for the help anyways!
answered Nov 9 at 8:21
Mxm
237
237
You maybe just lost Visual studio by renaming folders. Sometime restarting VS is enough.
– Grégory L
Nov 9 at 8:33
add a comment |
You maybe just lost Visual studio by renaming folders. Sometime restarting VS is enough.
– Grégory L
Nov 9 at 8:33
You maybe just lost Visual studio by renaming folders. Sometime restarting VS is enough.
– Grégory L
Nov 9 at 8:33
You maybe just lost Visual studio by renaming folders. Sometime restarting VS is enough.
– Grégory L
Nov 9 at 8:33
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53221599%2fcant-access-other-public-classes-in-the-same-namespace%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Please share your other classes code which you can't access also. I guess you forgot to public these classes.
– Nhan Phan
Nov 9 at 7:48
1
@Nhan Based on "but I can access them like they aren't in a namespace" it sounds more like OP has removed the namespace declaration from around them, or they're actually in the same namespace as the code where OP is using them.
– John
Nov 9 at 7:49
OP, please provide examples of these classes in your question, including their namespaces, etc.
– John
Nov 9 at 7:50
1
Namespaces are not folders. Don't look at the folder structure; look at the namespace declarations for each class.Or use Visual Studio's Object Browser (on the View menu) and do a search for your class; it might not be where you think it is.
– John Wu
Nov 9 at 7:50
@John added pictures.
– Mxm
Nov 9 at 7:55