I have the following code returning the error ” ‘object’ does not contain a constructor that takes x arguments.” on the line trying to call the base constructor.
Solution 1, project 1
namespace Project.Sub.A
{
internal class Foo
{
internal Foo(int a, long b) {}
}
}
Solution 1,project 2
namespace Project.Sub.B{
internal class Bar : Foo
{
internal Bar(int a, long b,long c) :base(a,b+c) {}
}
}
I have NO idea why this does not want to work. Could be my namespaces configured incorrectly?
internalaccess is per assembly, not namespace.Because the constructor in the base class is declared
internal, it is not accessible to the subclass in the other project. Try changing it toprotected internal, or justprotected.update
Just noticed that the base class is also
internal. You will need to make itpublicif you want it to be seen in the second project. Or, you can add[assembly:InternalsVisibleTo("Project2")]inAssemblyInfo.csin Project1. (I wouldn’t personally recommend this option, though.)