Re: Can't use using in method???
From: Jon Skeet [C# MVP] (skeet_at_pobox.com)
Date: 04/01/04
- Next message: Veibert M Pinontoan: "Catastrophic Failure"
- Previous message: Branimir Giurov: "Re: datagrid custom validation"
- In reply to: Julie: "Re: Can't use using in method???"
- Next in thread: Julie: "Re: Can't use using in method???"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 1 Apr 2004 08:14:13 +0100
Julie <julie@nospam.com> wrote:
> > Why, exactly?
>
> I'm finding it hard to justify -- essentially it renders namespaces useless to
> just strip away the namespace w/ a using statement.
It doesn't render them useless at all. Namespaces prevent name
collision. If you have two classes with the same name in different
namespaces, you can always disambiguate by using the full name, which
you couldn't do without namespaces. The "using" statement just allows
you to avoid typing the full name when there *aren't* any collisions.
> In C++, you can use a using within function scope, that is why I was asking. I
> had never used it, but I'm finding all sorts of problems w/ the global using
> directive and name clashes due to the stripping of the namespace.
What sort of problems? How often is this occurring? I ask because I
only run into it once in a blue moon...
> I'll probably just stop 'using' all together, seems that it would make for
> longer names, but explicitly more clear code.
I think you'll find you either change your mind quickly, or if you're
working with others they'll petition you to change your mind. There's a
good reason why basically no-one does this.
-- Jon Skeet - <skeet@pobox.com> http://www.pobox.com/~skeet If replying to the group, please do not mail me too
- Next message: Veibert M Pinontoan: "Catastrophic Failure"
- Previous message: Branimir Giurov: "Re: datagrid custom validation"
- In reply to: Julie: "Re: Can't use using in method???"
- Next in thread: Julie: "Re: Can't use using in method???"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|