[AttributeUsage(AttributeTargets.Class)] |
// Context-bound type with the Synchronization context attribute.
[Synchronization()]
public class SampleSyncronized : ContextBoundObject {
// A method that does some work, and returns the square of the given number.
public int Square(int i) {
Console.Write("The hash of the thread executing ");
Console.WriteLine("SampleSyncronized.Square is: {0}",
Thread.CurrentThread.GetHashCode());
return i*i;
}
}
| ctor #1 | Overloaded:.ctor()Default constructor. This constructor is called by derived class constructors to initialize state in this type.Initializes a new instance of the SynchronizationAttribute class with default values. |
| ctor #2 | Overloaded:.ctor(bool reEntrant) Initializes a new instance of the SynchronizationAttribute class with a Boolean value indicating whether reentry is required. |
| ctor #3 | Overloaded:.ctor(int flag) Initializes a new instance of the SynchronizationAttribute class with a flag indicating the behavior of the object to which this attribute is applied. |
| ctor #4 | Overloaded:.ctor(int flag, bool reEntrant) Initializes a new instance of the SynchronizationAttribute class with a flag indicating the behavior of the object to which this attribute is applied, and a Boolean value indicating whether reentry is required. |
| NOT_SUPPORTED | Indicates that the class to which this attribute is applied cannot be created in a context that has synchronization. This field is constant. |
| REQUIRED | Indicates that the class to which this attribute is applied must be created in a context that has synchronization. This field is constant. |
| REQUIRES_NEW | Indicates that the class to which this attribute is applied must be created in a context with a new instance of the synchronization property each time. This field is constant. |
| SUPPORTED | Indicates that the class to which this attribute is applied is not dependent on whether the context has synchronization. This field is constant. |
| IsReEntrant | Read-only Gets or sets a Boolean value indicating whether reentry is required. |
| Locked | Read-write Gets or sets a Boolean value indicating whether the Context implementing this instance of SynchronizationAttribute is locked. |
| Name (inherited) | Read-only See base class member description: System.Runtime.Remoting.Contexts.IContextProperty.Name Gets the name of the property under which it will be added to the context. |
| TypeId (inherited from System.Attribute) |
Read-only See base class member description: System.Attribute.TypeId When implemented in a derived class, gets a unique identifier for this Attribute. |
| Equals (inherited from System.Object) |
See base class member description: System.Object.Equals Derived from System.Object, the primary base class for all objects. |
| Freeze (inherited) | See base class member description: System.Runtime.Remoting.Contexts.IContextProperty.Freeze Called when the context is frozen. |
| GetClientContextSink | Creates a CallOut sink and chains it in front of the provided chain of sinks at the context boundary on the client end of a remoting call. |
| GetHashCode (inherited from System.Attribute) |
See base class member description: System.Attribute.GetHashCode Returns the hash code for this instance. |
| GetPropertiesForNewContext | Overridden: Adds the Synchronized context property to the specified IConstructionCallMessage. |
| GetServerContextSink | Creates a synchronized dispatch sink and chains it in front of the provided chain of sinks at the context boundary on the server end of a remoting call. |
| GetType (inherited from System.Object) |
See base class member description: System.Object.GetType Derived from System.Object, the primary base class for all objects. |
| IsContextOK | Overridden: Returns a Boolean value indicating whether the context parameter meets the context attribute's requirements. |
| IsDefaultAttribute (inherited from System.Attribute) |
See base class member description: System.Attribute.IsDefaultAttribute When overridden in a derived class, returns an indication whether the value of this instance is the default value for the derived class. |
| IsNewContextOK (inherited) | See base class member description: System.Runtime.Remoting.Contexts.IContextProperty.IsNewContextOK Returns a Boolean value indicating whether the context property is OK with the new context. |
| Match (inherited from System.Attribute) |
See base class member description: System.Attribute.Match When overridden in a derived class, returns a value indicating whether this instance equals a specified object. |
| ToString (inherited from System.Object) |
See base class member description: System.Object.ToString Derived from System.Object, the primary base class for all objects. |
| AttributeName (inherited) | This member is inherited from a type or implements a member of an interface which internally supports the .NET Framework infrastructure and is not intended to be used directly from your code. |
| Finalize (inherited from System.Object) |
See base class member description: System.Object.Finalize Derived from System.Object, the primary base class for all objects. |
| MemberwiseClone (inherited from System.Object) |
See base class member description: System.Object.MemberwiseClone Derived from System.Object, the primary base class for all objects. |
Hierarchy:
public SynchronizationAttribute(); |
public SynchronizationAttribute( |
reEntrant
public SynchronizationAttribute( |
flag
| Exception Type | Condition |
|---|---|
| ArgumentException | The flag parameter was not one of the defined flags. |
flag
reEntrant
| Exception Type | Condition |
|---|---|
| ArgumentException | The flag parameter was not one of the defined flags. |
public const int NOT_SUPPORTED;
|
public const int REQUIRED;
|
public const int REQUIRES_NEW;
|
public const int SUPPORTED;
|
public virtual bool IsReEntrant {get;}
|
public virtual bool Locked {get; set;}
|
string Name {get;}
|
public virtual object TypeId {get;}
|
~SynchronizationAttribute(); |
void Freeze( |
newContext
public virtual IMessageSink GetClientContextSink( |
nextSink
public override int GetHashCode(); |
public override void GetPropertiesForNewContext( |
ctorMsg
public virtual IMessageSink GetServerContextSink( |
nextSink
public Type GetType(); |
public override bool IsContextOK( |
ctx
msg
| Exception Type | Condition |
|---|---|
| ArgumentNullException | The ctx or msg parameter is null. |
public virtual bool IsDefaultAttribute(); |
The implementation of this method in a derived class compares the value of this instance to a standard, default value obtained by some means, then returns a Boolean value that indicates whether the value of this instance is equal to the standard. The standard value is typically coded as a constant in the implementation, or stored programmatically in a field used by the implementation.
newCtx
obj
protected object MemberwiseClone(); |
public virtual string ToString(); |