Click here to Skip to main content
15,897,518 members
Home / Discussions / C#
   

C#

 
AnswerRe: Showing and interact with HTML-Pages without WebBrowser Control? Pin
Abhinav S30-Mar-10 21:45
Abhinav S30-Mar-10 21:45 
QuestionSessions in C# Desktop Application Pin
Anil Kumar.Arvapalli30-Mar-10 20:27
Anil Kumar.Arvapalli30-Mar-10 20:27 
AnswerRe: Sessions in C# Desktop Application Pin
Khaniya30-Mar-10 20:41
professionalKhaniya30-Mar-10 20:41 
AnswerRe: Sessions in C# Desktop Application Pin
OriginalGriff30-Mar-10 22:04
mveOriginalGriff30-Mar-10 22:04 
QuestionStoring and Retrieving Image in Access Pin
Anil Kumar.Arvapalli30-Mar-10 20:24
Anil Kumar.Arvapalli30-Mar-10 20:24 
AnswerRe: Storing and Retrieving Image in Access Pin
Dan Mos30-Mar-10 21:52
Dan Mos30-Mar-10 21:52 
QuestionSynchnroization with lock statement Pin
xkrja30-Mar-10 20:23
xkrja30-Mar-10 20:23 
AnswerRe: Synchnroization with lock statement Pin
SeMartens30-Mar-10 21:26
SeMartens30-Mar-10 21:26 
Hi,

you have to use the lock-statement while adding and removing and also for non-changing operations.

The lock-statement is like a monitor (imagine a gatekeeper) that allows execution of a critical code block. So to be sure if you have several critical blocks that only one block is executed at one time you have to use the same gatekeeper for all blocks.

Example:

<br />
// declare a lock-object (the gatekeeper)<br />
private Object thisLock = new Object();<br />
<br />
public void AddItem(object item) {<br />
  lock(thisLock) {<br />
     // add to the list<br />
  }<br />
}<br />
<br />
public object FindItem(object criteria) {<br />
  lock(thisLock) {<br />
     // search within the list<br />
  }<br />
}<br />


Be pay attention that all access to the list is within a lock-statement using the same object (gatekeeper).

Hope this helps a bit.

Regards
Sebastian
It's not a bug, it's a feature!

Check out my CodeProject article Permission-by-aspect.

Me in Softwareland.

GeneralRe: Synchnroization with lock statement Pin
xkrja30-Mar-10 22:10
xkrja30-Mar-10 22:10 
GeneralRe: Synchnroization with lock statement Pin
SeMartens30-Mar-10 22:21
SeMartens30-Mar-10 22:21 
GeneralRe: Synchnroization with lock statement Pin
xkrja30-Mar-10 22:26
xkrja30-Mar-10 22:26 
QuestionProgresBar Pin
Anil Kumar.Arvapalli30-Mar-10 20:20
Anil Kumar.Arvapalli30-Mar-10 20:20 
AnswerRe: ProgresBar Pin
Khaniya30-Mar-10 20:24
professionalKhaniya30-Mar-10 20:24 
QuestionPlay sound Pin
jojoba201130-Mar-10 20:06
jojoba201130-Mar-10 20:06 
AnswerRe: Play sound Pin
Khaniya30-Mar-10 20:18
professionalKhaniya30-Mar-10 20:18 
QuestionRe: Play sound [modified] Pin
jojoba201130-Mar-10 21:10
jojoba201130-Mar-10 21:10 
AnswerRe: Play sound Pin
Kristian Sixhøj31-Mar-10 0:14
Kristian Sixhøj31-Mar-10 0:14 
QuestionXml Deserialization Pin
VCsamir30-Mar-10 19:43
VCsamir30-Mar-10 19:43 
AnswerRe: Xml Deserialization Pin
Arun Jacob30-Mar-10 20:09
Arun Jacob30-Mar-10 20:09 
GeneralRe: Xml Deserialization Pin
VCsamir30-Mar-10 21:37
VCsamir30-Mar-10 21:37 
AnswerRe: Xml Deserialization Pin
Mirko198030-Mar-10 21:43
Mirko198030-Mar-10 21:43 
GeneralRe: Xml Deserialization Pin
VCsamir4-Apr-10 20:21
VCsamir4-Apr-10 20:21 
QuestionPassing Value From One Form To Another! [modified] Pin
Sr...Frank30-Mar-10 18:22
Sr...Frank30-Mar-10 18:22 
AnswerRe: Passing Value From One Form To Another! Pin
Anubhava Dimri30-Mar-10 18:27
Anubhava Dimri30-Mar-10 18:27 
AnswerRe: Passing Value From One Form To Another! Pin
Praveen Raghuvanshi30-Mar-10 18:45
professionalPraveen Raghuvanshi30-Mar-10 18:45 

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.