Re: current type in static methods
From: codymanix (no_spam_deutronium_at_gmx.net)
Date: 03/24/04
- Next message: Chris: "Re: IO Stream HELP URGENT!!!"
- Previous message: Vinny Vinn: "RE: Return ArrayList from Method - How?"
- In reply to: Daniel O'Connell [C# MVP]: "Re: current type in static methods"
- Next in thread: Jon Skeet [C# MVP]: "Re: current type in static methods"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 24 Mar 2004 15:28:51 +0100
> >> And what would you consider this to mean?
> >>
> >> class A
> >> {
> >> static int s=1234;
> >>
> >> int getS()
> >> {
> >> return class.s; //note the use of class here
> >> }
> >> }
> >>
> >> My point is more in should class exist within instance methods, or
should
> > it
> >> be valid only in static.
> >
> >
> > if a keyword "class" could be used to identify the current class, it
> > should
> > be allowed in static *and* instance methods,
> > because using GetType() or class has a different meaning, so using class
> > in
> > instance method is useful too
[..]
> Which misses my point entirely. I was suggesting the usage of class as a
> pointer similar to this, instead of as a type explictly, typeof(class) may
> or may not make sense in this particular situation.
>
> Personally, typeof(class) is far to limited to be a feature on its own. It
> introduces a use of class that is inconsistent with the rest of hte
> langauge.
either we say that in *both* static and instance methods we can say
typeof(this) and this.DoIt()
or we say in static methods we must use typeof(class) and class.DoIt()
instead.
these are the options. the first option alters the meaning of the "this"
keyword which is not good.
the latter would allow the existing keyword "class" to be used within
methods where it was disallowed up to this time.
-- cody Freeware Tools, Games and Humour http://www.deutronium.de.vu || http://www.deutronium.tk
- Next message: Chris: "Re: IO Stream HELP URGENT!!!"
- Previous message: Vinny Vinn: "RE: Return ArrayList from Method - How?"
- In reply to: Daniel O'Connell [C# MVP]: "Re: current type in static methods"
- Next in thread: Jon Skeet [C# MVP]: "Re: current type in static methods"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|