■
Note
This book doesn’t dive into the details of building custom object contexts; however, if you are interested
in learning more, check out Applied .NET Attributes, by Jason Bock and Tom Barnaby (Apress, 2003).
Defining a Context-Bound Object
Assume that you wish to define a class (SportsCarTS) that is automatically thread safe in nature,
even though you have not hard-coded thread synchronization logic within the member implemen-
tations. To do so, derive from ContextBoundObject and apply the [Synchronization] attribute as
follows:
using System.Runtime.Remoting.Contexts;
Do'stlaringiz bilan baham: |