‘namespace’ but is used like a ‘type’

I suspect you’ve got the same problem at least twice.

Here:

namespace TimeTest
{
    class TimeTest
    {
}

… you’re declaring a type with the same name as the namespace it’s in. Don’t do that.

Now you apparently have the same problem with Time2. I suspect if you add:

using Time2;

to your list of using directives, your code will compile. But please, please, please fix the bigger problem: the problematic choice of names. (Follow the link above to find out more details of why it’s a bad idea.)

(Additionally, unless you’re really interested in writing time-based types, I’d advise you not to do so… and I say that as someone who does do exactly that. Use the built-in capabilities, or a third party library such as, um, mine. Working with dates and times correctly is surprisingly hairy. 🙂

Leave a Comment