开发者

Unable to find the enum reference which is declared in same namespace in .net 3.5

I have created a class library project which has number of classes and enums. All are declared in same name space. However, while compiling the class library itself some other classes/methods reports error that not fininding the reference to perticular enums. I have declared enum as public.

namespace CommonInterfaces
{
        publ开发者_StackOverflow中文版ic enum SettingsType
        {
              EnumType1,
        EnumTYpe2,
        EnumType3
        }
}

namespace CommonInterfaces
{
        public interface IPlayer
        {       
          void Add(SettingsType type); <-- Error occured.
       }
}

I tried giving full qualified name like CommonInterfaces.SettingsType but still it did not resove the problem. The exact error is

Error 1 The type or namespace name 'SettingsType' does not exist in the namespace 'CommonInterfaces'(are you missing an assembly reference?)

How to resolve the error?


Maybe its nested in other class? Then u have to use it like this: OtherClass.EnumName. Its only idea i have now. Such error could be solved only by knowing ur source code or at least where u define Enum and where it cannot be found.


i ran into this problem while using xamarin in vs2019. i cleaned and rebuilt solution again and again but didnt work then i restarted visual studio and problem gone.


I ran into this problem in VS2019. Restarting Visual Studio solved the problem.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜