Reputation: 10153
I have 2 classes in different files in the same namespace.
I need to share an enum
between them. I tried to define it in one of them as internal
- didn't work for me (the other class does not recognize the enum
)
What could be a solution?
Upvotes: 0
Views: 99
Reputation: 3683
File 1:
namespace GlobalNameSpace
{
public class FirstClass
{
}
}
File 2:
namespace GlobalNameSpace
{
public class SecondClass
{
}
}
File 3:
namespace GlobalNameSpace
{
public enum SharedEnum
{
FirstValue,
SecondValue,
ThirdValue
}
}
Upvotes: 1
Reputation: 555
Create your enum in another class and put your enum in there. Then reference that class in both your other classes
Upvotes: 0