Hi John,

I get your point. I don't see a need to add and mix those totals, but if
there would be one, I would add a method to return the grand total instead
of using each property. However, your reply made me think about the need for
"get" properties for the totals. Normally the batch would have to be closed
and after that I would need to get the totals for reconciliation with the
bank. While the batch is closed, the object would reject any new
transaction, so those totals would not change.

Anyway, thank you for your reply.
Regards,
Eddie

-----Original Message-----
From: Discussion of advanced .NET topics.
[mailto:[EMAIL PROTECTED] Behalf Of John Brett
Sent: Friday, August 11, 2006 3:38 AM
To: [email protected]
Subject: Re: [ADVANCED-DOTNET] Multithread-safe classes


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

===================================
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