Click here to Skip to main content
15,894,405 members
Home / Discussions / C#
   

C#

 
GeneralRe: Adding dll to the workspace Pin
Heath Stewart31-Dec-04 6:38
protectorHeath Stewart31-Dec-04 6:38 
GeneralRe: Adding dll to the workspace Pin
Md Saleem Navalur31-Dec-04 21:29
Md Saleem Navalur31-Dec-04 21:29 
GeneralRe: Adding dll to the workspace Pin
Heath Stewart31-Dec-04 22:49
protectorHeath Stewart31-Dec-04 22:49 
Questionhow to lock a method in class Pin
ting66830-Dec-04 22:11
ting66830-Dec-04 22:11 
AnswerRe: how to lock a method in class Pin
Robert Rohde30-Dec-04 22:19
Robert Rohde30-Dec-04 22:19 
AnswerRe: how to lock a method in class Pin
Heath Stewart31-Dec-04 6:26
protectorHeath Stewart31-Dec-04 6:26 
GeneralRe: how to lock a method in class Pin
ting6682-Jan-05 15:13
ting6682-Jan-05 15:13 
GeneralRe: how to lock a method in class Pin
Heath Stewart2-Jan-05 21:18
protectorHeath Stewart2-Jan-05 21:18 
ting668 wrote:
Then using the same reference of a instance of class1, after calling MethodA and MethodA not yet finished executing within the lock, MethodB still can be called unless lock(this) is also used in MethodB?

That is correct. Just try it. The majority of code snippets I post here in this forum I simply type in a simple text editor and compile on the command line, then run. Simple.

ting668 wrote:
Also is that the static method will be automatically synchronized and special keyword and code (e.g lock) is not needed to be implemented?

A single static method is synchronized by the CLR. If you want to synchronize different static methods you will need to use lock or some equivalent.

ting668 wrote:
Is lock useless for single thread programming?

Yes. Within a single thread you can only execute one statement at a time. With that in mind there's no way you could execute the same method (or act on the same context, like getting or setting a serial number) at the same time.

This posting is provided "AS IS" with no warranties, and confers no rights.

Software Design Engineer
Developer Division Sustained Engineering
Microsoft

[My Articles] [My Blog]
GeneralRe: how to lock a method in class Pin
ting6683-Jan-05 14:49
ting6683-Jan-05 14:49 
GeneralRe: how to lock a method in class Pin
Heath Stewart3-Jan-05 18:47
protectorHeath Stewart3-Jan-05 18:47 
QuestionIs this kind of encapsulation right for the event and delegate? Pin
Salil Khedkar30-Dec-04 20:00
Salil Khedkar30-Dec-04 20:00 
AnswerRe: Is this kind of encapsulation right for the event and delegate? Pin
Heath Stewart30-Dec-04 20:29
protectorHeath Stewart30-Dec-04 20:29 
GeneralRe: Is this kind of encapsulation right for the event and delegate? Pin
Salil Khedkar2-Jan-05 21:26
Salil Khedkar2-Jan-05 21:26 
Generalload values into the dataset form the xml Pin
dhol30-Dec-04 19:11
dhol30-Dec-04 19:11 
GeneralProgrammetically Selection of Language Pin
SoloVision30-Dec-04 18:22
SoloVision30-Dec-04 18:22 
GeneralRe: Programmetically Selection of Language Pin
Heath Stewart30-Dec-04 20:14
protectorHeath Stewart30-Dec-04 20:14 
Generalprogramticly scroll a richtextbox Pin
Tyrus18230-Dec-04 14:46
Tyrus18230-Dec-04 14:46 
GeneralRe: programticly scroll a richtextbox Pin
Heath Stewart30-Dec-04 20:06
protectorHeath Stewart30-Dec-04 20:06 
Generalusing non true type or open type fonts Pin
Tyrus18230-Dec-04 14:43
Tyrus18230-Dec-04 14:43 
Questionwhat is wrong here ? Pin
kings_130-Dec-04 11:38
kings_130-Dec-04 11:38 
AnswerRe: what is wrong here ? Pin
Heath Stewart30-Dec-04 12:06
protectorHeath Stewart30-Dec-04 12:06 
GeneralRe: what is wrong here ? Pin
kings_130-Dec-04 19:46
kings_130-Dec-04 19:46 
GeneralRe: what is wrong here ? Pin
Heath Stewart30-Dec-04 20:01
protectorHeath Stewart30-Dec-04 20:01 
GeneralRe: what is wrong here ? Pin
kings_131-Dec-04 0:59
kings_131-Dec-04 0:59 
GeneralRe: what is wrong here ? Pin
Heath Stewart31-Dec-04 6:10
protectorHeath Stewart31-Dec-04 6:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.