Hi Eddie,

As an observation, "making the class multi-thread safe" as you're
describing won't help a caller doing something like:

double totalDebt;
totalDebt= batch.VisaTransactionsAmount + batch.AmexTransactionsAmount
+ batch.MCardAmount;

Locking access to each individual property on access won't stop
the object itself being updated part-way through evaluation of the summation.

Gregory's suggestions of using a value-type (which then represents
a snapshot of the state at a specific moment in time) would work.
Otherwise, you'll need to consider in detail how the object is used
and not just solve the "MT problem" in isolation.

John

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to