Click here to Skip to main content
15,887,821 members
Home / Discussions / C#
   

C#

 
QuestionPost-Build-Step: Copy New Files Pin
Tomerland26-Apr-07 1:38
Tomerland26-Apr-07 1:38 
AnswerRe: Post-Build-Step: Copy New Files Pin
Christian Graus26-Apr-07 1:54
protectorChristian Graus26-Apr-07 1:54 
QuestionDataGridView and Animated gif Problem! Pin
mertkan6526-Apr-07 0:45
mertkan6526-Apr-07 0:45 
QuestionDifference between SyncRoot property and Synchronized method? Pin
kumar.bs26-Apr-07 0:12
kumar.bs26-Apr-07 0:12 
AnswerRe: Difference between SyncRoot property and Synchronized method? Pin
Sathesh Sakthivel26-Apr-07 0:21
Sathesh Sakthivel26-Apr-07 0:21 
GeneralRe: Difference between SyncRoot property and Synchronized method? Pin
kumar.bs26-Apr-07 0:32
kumar.bs26-Apr-07 0:32 
GeneralRe: Difference between SyncRoot property and Synchronized method? Pin
Sathesh Sakthivel26-Apr-07 0:35
Sathesh Sakthivel26-Apr-07 0:35 
AnswerRe: Difference between SyncRoot property and Synchronized method? Pin
peterchen26-Apr-07 6:41
peterchen26-Apr-07 6:41 
Synchronized returns a collection that locks on each call, i.e. while you call a method or property, no other thread may modify the collection. This is convenient, but not enough.

Imagine the following code snippet:

// remove head
if (myList.Count > 0)
  myList.RemoveAt(0); 


In this case, you have two separate calls (querying "Count" and removing an object). However, between the calls, some other thread may access the list and e.g. clear it completely. In this case, RemoveAt will fail.

For that scenario, you get the SyncRoot:

lock(myList.SyncRoot)
{
  if (myList.Count > 0)
    myList.RemoveAt(0); 
}




We are a big screwed up dysfunctional psychotic happy family - some more screwed up, others more happy, but everybody's psychotic joint venture definition of CP
My first real C# project | Linkify!|FoldWithUs! | sighist

GeneralRe: Difference between SyncRoot property and Synchronized method? Pin
kumar.bs26-Apr-07 18:33
kumar.bs26-Apr-07 18:33 
GeneralRe: Difference between SyncRoot property and Synchronized method? Pin
peterchen27-Apr-07 3:20
peterchen27-Apr-07 3:20 
GeneralRe: Difference between SyncRoot property and Synchronized method? Pin
kumar.bs29-Apr-07 21:05
kumar.bs29-Apr-07 21:05 
QuestionUrgent: How to refresh the status bar during a process Pin
dudedotnet26-Apr-07 0:09
dudedotnet26-Apr-07 0:09 
AnswerRe: Urgent: How to refresh the status bar during a process Pin
Christian Graus26-Apr-07 0:25
protectorChristian Graus26-Apr-07 0:25 
GeneralRe: Urgent: How to refresh the status bar during a process Pin
dudedotnet26-Apr-07 0:31
dudedotnet26-Apr-07 0:31 
GeneralRe: Urgent: How to refresh the status bar during a process Pin
Christian Graus26-Apr-07 0:39
protectorChristian Graus26-Apr-07 0:39 
Questionvalidation (double) Pin
Keshav V. Kamat25-Apr-07 23:42
Keshav V. Kamat25-Apr-07 23:42 
AnswerRe: validation (double) Pin
Pete O'Hanlon26-Apr-07 0:12
mvePete O'Hanlon26-Apr-07 0:12 
Questionupload file Pin
nilima Dash25-Apr-07 23:29
nilima Dash25-Apr-07 23:29 
AnswerRe: upload file Pin
Christian Graus26-Apr-07 0:21
protectorChristian Graus26-Apr-07 0:21 
AnswerRe: upload file Pin
marky77726-Apr-07 1:42
marky77726-Apr-07 1:42 
QuestionHow to use Math Equation [of Word] in my software? Pin
Majid_grok25-Apr-07 23:14
Majid_grok25-Apr-07 23:14 
AnswerRe: How to use Math Equation [of Word] in my software? Pin
Aaron VanWieren26-Apr-07 5:19
Aaron VanWieren26-Apr-07 5:19 
Question.net Pin
nilima Dash25-Apr-07 23:13
nilima Dash25-Apr-07 23:13 
AnswerRe: .net Pin
Christian Graus25-Apr-07 23:25
protectorChristian Graus25-Apr-07 23:25 
AnswerRe: .net Pin
Keshav V. Kamat25-Apr-07 23:46
Keshav V. Kamat25-Apr-07 23:46 

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.