1

Possible Duplicate:
C# version of java's synchronized keyword?

I know that when working with a session in Java, you were always supposed to surround use of the session with a synchronized block incase the user would load your page with two browsers at the same time.

Is there an equivalent keyword/block in C# for doing the same thing?

1

1 Answer 1

4

You could use the lock statement or decorate a method with the [MethodImpl(MethodImplOptions.Synchronized)] attribute to allow access to this block/method only from a single thread at a time.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.