Re: Rationale for CS0536?




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?

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.

.



Relevant Pages

  • Re: Static vs Instance Method Question
    ... Jon Skeet [C# MVP] wrote: ... ThreadStart ts = SomeMethodToRun; ... What does it *look* like that call to Sleep is doing? ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Assistance needed: Cant timeout calling MSXML2.XMLHTTP control
    ... When I take out the echo statements in the original code, ... Doesn't using sleep negate the value of using an asynchronous Send? ... Microsoft MVP - ASP/ASP.NET ... This email account is my spam trap so I ...
    (microsoft.public.scripting.vbscript)
  • Re: Exiting a thread without mem-leak - yet another question
    ... have to do a Sleep() to make your threaded system work, ... on worker threads on my MVP Tips site. ... only reason you saw the "leak" was the thread hadn't finished yet, ... storage will be reclaimed anyway; and you are shutting down, ...
    (microsoft.public.vc.mfc)
  • Re: Rationale for CS0536?
    ... >> current thread to sleep since Sleep is a static method. ... > design or even naming problem, nothing that would have to be ... Weren't you just asking why the compiler didn't let you call static methods ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Java Code Convention Guidelines question...
    ... The issue is invoking a static method while ... a different thread to sleep. ... confusion, by implying that the method "sleep" acted on a specific other ... about whether a developer should intentionally pretend to act on some ...
    (comp.lang.java.programmer)