Interview Questions

How do I port "synchronized" functions from Visual J++ to C#?

C# Interview Questions and Answers


(Continued from previous question...)

94. How do I port "synchronized" functions from Visual J++ to C#?

Original Visual J++ code: public synchronized void Run()
{
// function body
}
Ported C# code: class C
{
public void Run()
{
lock(this)
{
// function body
}
}
public static void Main() {}
}

(Continued on next question...)

Other Interview Questions