Re: Rationale for CS0536?
- From: "Daniel O'Connell [C# MVP]" <onyxkirx@xxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 12 Sep 2005 16:14:11 -0500
<elvis_the_king@xxxxxx> wrote in message
news:1126558497.073068.177850@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
>
> Daniel O'Connell [C# MVP] schrieb:
>
>> Thread t = ...;
>> t.Sleep(10);
>>
>> What does that look like its doing to you? To me it looks like its
>> putting
>> the thread referenced by t to sleep, however, its not. It is putting the
>> current thread to sleep since Sleep is a static method. If you did around
>> you will find alot of examples where that occurs.
>
> Well, that sounds reasonable; but I would just consider that a bad
> design or even naming problem, nothing that would have to be
> interdicted by the language itself?
It is not bad design, calling statics via instances is a bad idea. Allowing
what Java and C++ does and waht you suggested causes that problem.
>
> Besides that - I think I've seen compiler errors that say static
> members have to be qualified with a type name, not an instance
> (CS0176)? But probably that gets off-topic here.
Weren't you just asking why the compiler didn't let you call static methods
through instances and now you are using the compilers actual behavior as an
argument against my reason for the compiler acting that way? That just
doesn't make any sense, to be honest.
.
- Follow-Ups:
- Re: Rationale for CS0536?
- From: elvis_the_king@xxxxxx
- Re: Rationale for CS0536?
- References:
- Rationale for CS0536?
- From: elvis_the_king
- Re: Rationale for CS0536?
- From: Nicholas Paldino [.NET/C# MVP]
- Re: Rationale for CS0536?
- From: elvis_the_king@xxxxxx
- Re: Rationale for CS0536?
- From: Daniel O'Connell [C# MVP]
- Re: Rationale for CS0536?
- From: elvis_the_king@xxxxxx
- Rationale for CS0536?
- Prev by Date: Datagrid clear and add records
- Next by Date: Threads.
- Previous by thread: Re: Rationale for CS0536?
- Next by thread: Re: Rationale for CS0536?
- Index(es):
Relevant Pages
|
|