Sunday, 15 March 2015

c# - 'namespace' but is used like a 'type' -



c# - 'namespace' but is used like a 'type' -

this programme class uses called time2 have reference added timetest maintain getting error 'time2' 'namespace' used 'type'

could please tell me error , how prepare it?

namespace timetest { class timetest { static void main(string[] args) { time2 t1 = new time2(); } }

}

i suspect you've got same problem at to the lowest degree twice.

here:

namespace timetest { class timetest { }

... you're declaring type same name namespace it's in. don't that.

now apparently have same problem time2. suspect if add:

using time2;

to list of using directives, code compile. please, please, please prepare bigger problem: problematic selection of names. (follow link above find out more details of why it's bad idea.)

(additionally, unless you're interested in writing time-based types, i'd advise not so... , does that. utilize built-in capabilities, or 3rd party library such as, um, mine. working dates , times correctly surprisingly hairy. :)

c# class namespaces

No comments:

Post a Comment