Question:You are writing a method that tracks the total number of orders in shopping carts on your Web site. Orders might come from different users, and the request to increment the counter might come from different threads. Which of the following code samples increments the orders integer and guarantees accurate results? - VB.NET 

A orders += 1 

B SyncLock orders
orders += 1
End SyncLock 

C Interlocked.Increment(orders)
 

D Dim rwl As New ReaderWriterLock()
rwl.AcquireReaderLock(10000)
orders += 1
rwl.ReleaseReaderLock() 

+ Answer
+ Report
Total Preview: 1137

Copyright © 2024. Powered by Intellect Software Ltd