Home > Enterprise >  Can't use a public class in another even after using the namespace
Can't use a public class in another even after using the namespace

Time:08-25

I have a class A in C#, and I built another test class for A, named B. But I'm having issues with referring public class from class A. For example:

namespace classA
{
    public class ClassAFuncs
    {      public static int Funcs(){};
    }
}

using classA;
namespace classA.Test
{ 
    public class ClassAFuncs.Test{
        public static void TestFuncs(){
         int res = ClassAFuncs.Funcs() ## does not work
        };
}
}
     

The error always says "CS0103: ClassAFuncs" doesn't exist in the current content I have made sure that class A has been added as a dependency to the Test Class as all other posts suggested.

CodePudding user response:

Use a namespace alias

  • Related