Employee, and I noticed something strange with Razor and imported namespaces.
Here is our test class, which we will try to get both from the C # file and from the Razor view.
namespace test
{
public class c1 {}
}
namespace test.sub
{
public class c2 {}
}
This is a sample of our C # code.
using test;
namespace test
{
public class testbed
{
testbed()
{
c1 o1 = new c1();
test.sub.c2 o2 = new test.sub.c2();
sub.c2 o3 = new sub.c2();
}
}
}
This is a sample of our Razor code. "under" namespace is not available.
@using test
@(new c1()) @* Works *@
@(new test.sub.c2()) @* Works *@
@(new sub.c2()) @* Cannot be seen *@
Does anyone have an explanation why this works in our class files, but not in our views?
source
share