SynchronizationAttribute クラス
アセンブリ: System.EnterpriseServices (system.enterpriseservices.dll 内)

<ComVisibleAttribute(False)> _ <AttributeUsageAttribute(AttributeTargets.Class, Inherited:=True)> _ Public NotInheritable Class SynchronizationAttribute Inherits Attribute
[ComVisibleAttribute(false)] [AttributeUsageAttribute(AttributeTargets.Class, Inherited=true)] public sealed class SynchronizationAttribute : Attribute
[ComVisibleAttribute(false)] [AttributeUsageAttribute(AttributeTargets::Class, Inherited=true)] public ref class SynchronizationAttribute sealed : public Attribute

同期はトランザクションとジャスト イン タイム (JIT: Just-In-Time) の両方のアクティベーションによって自動的に有効になります。
属性の使用方法については、「属性を使用したメタデータの拡張」を参照してください。
SynchronizationAttribute をコンテキスト バインド オブジェクトに適用すると、待機ハンドルと自動リセット イベントが作成されます。この待機ハンドルと自動リセット イベントは、ガベージ コレクションで収集されないことがあります。したがって、短期間に SynchronizationAttribute でマークされたコンテキスト バインド オブジェクトを大量に作成しないでください。

SynchronizationAttribute 型の使用方法のコード例を次に示します。
Imports System Imports System.EnterpriseServices Imports System.Reflection ' References: ' System.EnterpriseServices ' This is equivalent to [Synchronization(SynchronizationOption.Required)]. <Synchronization()> _ Public Class SynchronizationAttribute_Ctor Inherits ServicedComponent End Class 'SynchronizationAttribute_Ctor <Synchronization(SynchronizationOption.Disabled)> _ Public Class SynchronizationAttribute_Ctor_SynchronizationOption Inherits ServicedComponent End Class 'SynchronizationAttribute_Ctor_SynchronizationOption <Synchronization(SynchronizationOption.RequiresNew)> _ Public Class SynchronizationAttribute_Value Inherits ServicedComponent Public Sub ValueExample() ' Get the SynchronizationAttribute applied to the class. Dim attribute As SynchronizationAttribute = CType(Attribute.GetCustomAttribute(Me.GetType(), GetType(SynchronizationAttribute), False), SynchronizationAttribute) ' Display the value of the attribute's Value property. MsgBox("SynchronizationAttribute.Value: " & attribute.Value) End Sub 'ValueExample End Class 'SynchronizationAttribute_Value
using System; using System.EnterpriseServices; using System.Reflection; // References: // System.EnterpriseServices // This is equivalent to [Synchronization(SynchronizationOption.Required)]. [Synchronization] public class SynchronizationAttribute_Ctor : ServicedComponent { } [Synchronization(SynchronizationOption.Disabled)] public class SynchronizationAttribute_Ctor_SynchronizationOption : ServicedComponent { } [Synchronization(SynchronizationOption.RequiresNew)] public class SynchronizationAttribute_Value : ServicedComponent { public void ValueExample() { // Get the SynchronizationAttribute applied to the class. SynchronizationAttribute attribute = (SynchronizationAttribute)Attribute.GetCustomAttribute( this.GetType(), typeof(SynchronizationAttribute), false); // Display the value of the attribute's Value property. Console.WriteLine("SynchronizationAttribute.Value: {0}", attribute.Value); } }
import System.*; import System.EnterpriseServices.*; import System.Reflection.*; // References: // System.EnterpriseServices // This is equivalent to [Synchronization(SynchronizationOption.Required)]. /** @attribute Synchronization() */ public class SynchronizationAttribute_Ctor extends ServicedComponent { } //SynchronizationAttribute_Ctor /** @attribute Synchronization(SynchronizationOption.Disabled) */ public class SynchronizationAttribute_Ctor_SynchronizationOption extends ServicedComponent { } //SynchronizationAttribute_Ctor_SynchronizationOption /** @attribute Synchronization(SynchronizationOption.RequiresNew) */ public class SynchronizationAttribute_Value extends ServicedComponent { public void ValueExample() { // Get the SynchronizationAttribute applied to the class. SynchronizationAttribute attribute = (SynchronizationAttribute)( Attribute.GetCustomAttribute(this.GetType(), SynchronizationAttribute.class.ToType(), false)); // Display the value of the attribute's Value property. Console.WriteLine("SynchronizationAttribute.Value: {0}", attribute.get_Value()); } //ValueExample } //SynchronizationAttribute_Value

System.Attribute
System.EnterpriseServices.SynchronizationAttribute


Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


SynchronizationAttribute クラス
アセンブリ: mscorlib (mscorlib.dll 内)

<SerializableAttribute> _ <AttributeUsageAttribute(AttributeTargets.Class)> _ <ComVisibleAttribute(True)> _ Public Class SynchronizationAttribute Inherits ContextAttribute Implements IContributeServerContextSink, IContributeClientContextSink
[SerializableAttribute] [AttributeUsageAttribute(AttributeTargets.Class)] [ComVisibleAttribute(true)] public class SynchronizationAttribute : ContextAttribute, IContributeServerContextSink, IContributeClientContextSink
[SerializableAttribute] [AttributeUsageAttribute(AttributeTargets::Class)] [ComVisibleAttribute(true)] public ref class SynchronizationAttribute : public ContextAttribute, IContributeServerContextSink, IContributeClientContextSink

この属性をオブジェクトに適用する場合、このプロパティのインスタンスを共有するすべてのコンテキスト内で実行できるスレッドは 1 つだけです。それぞれのコンテキストの着信呼び出しを受け取り、シリアル化するシンクを提供することによって実行されます。プロパティが再エントリとしてマークされている場合は、コールアウトも受け取られます。コールアウトを受け取ることにより、待機している他のスレッドが同期ドメインに参加できるようになり、最大限のスループットを実現できます。
![]() |
---|
SynchronizationAttribute という名前のクラスが 2 つあります。1 つは System.Runtime.Remoting.Contexts 名前空間に格納され、もう 1 つは System.EnterpriseServices 名前空間に格納されています。System.EnterpriseServices.SynchronizationAttribute クラスは、同期呼び出しだけをサポートし、サービス コンポーネントだけで使用できます。サービス コンポーネントの詳細については、「サービス コンポーネントの概要」を参照してください。System.Runtime.Remoting.Contexts.SynchronizationAttribute は、同期呼び出しおよび非同期呼び出しをサポートし、コンテキスト バインド オブジェクトだけで使用できます。コンテキスト バインド オブジェクトの詳細については ContextBoundObject クラスのトピックを参照してください。 |

SynchronizationAttribute の使用方法については、次のコード例を参照してください。プログラム例の全体については、AsyncResult クラスのトピックの例を参照してください。
' Context-bound type with the Synchronization context attribute. <Synchronization()> Public Class SampleSyncronized Inherits ContextBoundObject ' A method that does some work, and returns the square of the given number. Public Function Square(i As Integer) As Integer Console.Write("The hash of the thread executing ") Console.WriteLine("SampleSyncronized.Square is: {0}", Thread.CurrentThread.GetHashCode()) Return i * i End Function 'Square End Class 'SampleSyncronized
// 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; } }
// Context-bound type with the Synchronization context attribute. [Synchronization] public ref class SampleSyncronized: public ContextBoundObject { public: // A method that does some work, and returns the square of the given number. int Square( int i ) { Console::Write( "The hash of the thread executing " ); Console::WriteLine( "SampleSyncronized::Square is: {0}", Thread::CurrentThread->GetHashCode() ); return i * i; } };
// Context-bound type with the Synchronization context attribute. /** @attribute Synchronization() */ public class SampleSyncronized extends 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}", (Int32)System.Threading.Thread.get_CurrentThread().GetHashCode()); return i * i; } //Square } //SampleSyncronized


System.Attribute
System.Runtime.Remoting.Contexts.ContextAttribute
System.Runtime.Remoting.Contexts.SynchronizationAttribute


Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


SynchronizationAttribute コンストラクタ ()
アセンブリ: mscorlib (mscorlib.dll 内)


Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


SynchronizationAttribute コンストラクタ ()
アセンブリ: System.EnterpriseServices (system.enterpriseservices.dll 内)



新しい SynchronizationAttribute を作成するコード例を次に示します。
' This is equivalent to [Synchronization(SynchronizationOption.Required)]. <Synchronization()> _ Public Class SynchronizationAttribute_Ctor Inherits ServicedComponent End Class 'SynchronizationAttribute_Ctor
// This is equivalent to [Synchronization(SynchronizationOption.Required)]. [Synchronization] public class SynchronizationAttribute_Ctor : ServicedComponent { }
// This is equivalent to [Synchronization(SynchronizationOption.Required)]. /** @attribute Synchronization() */ public class SynchronizationAttribute_Ctor extends ServicedComponent { } //SynchronizationAttribute_Ctor


Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


SynchronizationAttribute コンストラクタ (Boolean)
アセンブリ: mscorlib (mscorlib.dll 内)



Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


SynchronizationAttribute コンストラクタ (Int32)
アセンブリ: mscorlib (mscorlib.dll 内)




Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


SynchronizationAttribute コンストラクタ (Int32, Boolean)
アセンブリ: mscorlib (mscorlib.dll 内)

Dim flag As Integer Dim reEntrant As Boolean Dim instance As New SynchronizationAttribute(flag, reEntrant)



Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


SynchronizationAttribute コンストラクタ (SynchronizationOption)
アセンブリ: System.EnterpriseServices (system.enterpriseservices.dll 内)


新しい SynchronizationAttribute を作成するコード例を次に示します。
<Synchronization(SynchronizationOption.Disabled)> _ Public Class SynchronizationAttribute_Ctor_SynchronizationOption Inherits ServicedComponent End Class 'SynchronizationAttribute_Ctor_SynchronizationOption
[Synchronization(SynchronizationOption.Disabled)] public class SynchronizationAttribute_Ctor_SynchronizationOption : ServicedComponent { }
/** @attribute Synchronization(SynchronizationOption.Disabled) */ public class SynchronizationAttribute_Ctor_SynchronizationOption extends ServicedComponent { } //SynchronizationAttribute_Ctor_SynchronizationOption


Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


SynchronizationAttribute コンストラクタ

名前 | 説明 |
---|---|
SynchronizationAttribute () | 既定の SynchronizationOption を使用して、SynchronizationAttribute クラスの新しいインスタンスを初期化します。 |
SynchronizationAttribute (SynchronizationOption) | SynchronizationOption を指定して、SynchronizationAttribute クラスの新しいインスタンスを初期化します。 |

SynchronizationAttribute コンストラクタ

名前 | 説明 |
---|---|
SynchronizationAttribute () | SynchronizationAttribute クラスの新しいインスタンスを既定値で初期化します。 |
SynchronizationAttribute (Boolean) | 再エントリが必要かどうかを示す Boolean 値を指定して、SynchronizationAttribute クラスの新しいインスタンスを初期化します。 |
SynchronizationAttribute (Int32) | この属性を適用するオブジェクトの動作を示すフラグを指定して、SynchronizationAttribute クラスの新しいインスタンスを初期化します。 |
SynchronizationAttribute (Int32, Boolean) | この属性を適用するオブジェクトの動作を示すフラグと、再エントリが必要かどうかを示す Boolean 値を指定して、SynchronizationAttribute クラスの新しいインスタンスを初期化します。 |

SynchronizationAttribute フィールド

名前 | 説明 | |
---|---|---|
![]() | NOT_SUPPORTED | この属性を適用したクラスを、同期を備えているコンテキスト内で作成できないことを示します。このフィールドは定数です。 |
![]() | REQUIRED | この属性を適用したクラスを、同期を備えているコンテキスト内で作成する必要があることを示します。このフィールドは定数です。 |
![]() | REQUIRES_NEW | この属性を適用したクラスを、同期プロパティの新しいインスタンスを使用して、コンテキスト内で毎回作成する必要があることを示します。このフィールドは定数です。 |
![]() | SUPPORTED | この属性を適用したクラスが、コンテキストが同期を備えているかどうかに依存しないことを示します。このフィールドは定数です。 |


SynchronizationAttribute プロパティ

名前 | 説明 | |
---|---|---|
![]() | TypeId | 派生クラスに実装されている場合は、この Attribute の一意の識別子を取得します。 ( Attribute から継承されます。) |
![]() | Value | Value プロパティの現在の設定を取得します。 |

SynchronizationAttribute プロパティ

名前 | 説明 | |
---|---|---|
![]() | IsReEntrant | 再エントリが必要かどうかを示す Boolean 値を取得または設定します。 |
![]() | Locked | この SynchronizationAttribute のインスタンスを実装する Context がロックされているかどうかを示す Boolean 値を取得または設定します。 |
![]() | Name | コンテキスト属性の名前を取得します。 ( ContextAttribute から継承されます。) |
![]() | TypeId | 派生クラスに実装されている場合は、この Attribute の一意の識別子を取得します。 ( Attribute から継承されます。) |

SynchronizationAttribute メソッド

名前 | 説明 | |
---|---|---|
![]() | Equals | オーバーロードされます。 ( Attribute から継承されます。) |
![]() | GetCustomAttribute | オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用された指定した型のカスタム属性を取得します。 ( Attribute から継承されます。) |
![]() | GetCustomAttributes | オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されたカスタム属性の配列を取得します。 ( Attribute から継承されます。) |
![]() | GetHashCode | このインスタンスのハッシュ コードを返します。 ( Attribute から継承されます。) |
![]() | GetType | 現在のインスタンスの Type を取得します。 ( Object から継承されます。) |
![]() | IsDefaultAttribute | 派生クラス内でオーバーライドされたときに、このインスタンスの値が派生クラスの既定値かどうかを示します。 ( Attribute から継承されます。) |
![]() | IsDefined | オーバーロードされます。 指定した型のカスタム属性が、アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されているかどうかを判断します。 ( Attribute から継承されます。) |
![]() | Match | 派生クラス内でオーバーライドされたときに、指定したオブジェクトとこのインスタンスが等しいかどうかを示す値を返します。 ( Attribute から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 ( Object から継承されます。) |
![]() | ToString | 現在の Object を表す String を返します。 ( Object から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 ( Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 ( Object から継承されます。) |

SynchronizationAttribute メソッド


名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 ( Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 ( Object から継承されます。) |

SynchronizationAttribute メンバ
コンポーネントの同期値を設定します。このクラスは継承できません。
SynchronizationAttribute データ型で公開されるメンバを以下の表に示します。


名前 | 説明 | |
---|---|---|
![]() | TypeId | 派生クラスに実装されている場合は、この Attribute の一意の識別子を取得します。(Attribute から継承されます。) |
![]() | Value | Value プロパティの現在の設定を取得します。 |

名前 | 説明 | |
---|---|---|
![]() | Equals | オーバーロードされます。 ( Attribute から継承されます。) |
![]() | GetCustomAttribute | オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用された指定した型のカスタム属性を取得します。 (Attribute から継承されます。) |
![]() | GetCustomAttributes | オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されたカスタム属性の配列を取得します。 (Attribute から継承されます。) |
![]() | GetHashCode | このインスタンスのハッシュ コードを返します。 (Attribute から継承されます。) |
![]() | GetType | 現在のインスタンスの Type を取得します。 (Object から継承されます。) |
![]() | IsDefaultAttribute | 派生クラス内でオーバーライドされたときに、このインスタンスの値が派生クラスの既定値かどうかを示します。 (Attribute から継承されます。) |
![]() | IsDefined | オーバーロードされます。 指定した型のカスタム属性が、アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されているかどうかを判断します。 (Attribute から継承されます。) |
![]() | Match | 派生クラス内でオーバーライドされたときに、指定したオブジェクトとこのインスタンスが等しいかどうかを示す値を返します。 (Attribute から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 (Object から継承されます。) |
![]() | ToString | 現在の Object を表す String を返します。 (Object から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 (Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 (Object から継承されます。) |

SynchronizationAttribute メンバ
現在のコンテキスト、および同じインスタンスを共有するすべてのコンテキストの同期ドメインを適用します。
SynchronizationAttribute データ型で公開されるメンバを以下の表に示します。


名前 | 説明 | |
---|---|---|
![]() | NOT_SUPPORTED | この属性を適用したクラスを、同期を備えているコンテキスト内で作成できないことを示します。このフィールドは定数です。 |
![]() | REQUIRED | この属性を適用したクラスを、同期を備えているコンテキスト内で作成する必要があることを示します。このフィールドは定数です。 |
![]() | REQUIRES_NEW | この属性を適用したクラスを、同期プロパティの新しいインスタンスを使用して、コンテキスト内で毎回作成する必要があることを示します。このフィールドは定数です。 |
![]() | SUPPORTED | この属性を適用したクラスが、コンテキストが同期を備えているかどうかに依存しないことを示します。このフィールドは定数です。 |


名前 | 説明 | |
---|---|---|
![]() | IsReEntrant | 再エントリが必要かどうかを示す Boolean 値を取得または設定します。 |
![]() | Locked | この SynchronizationAttribute のインスタンスを実装する Context がロックされているかどうかを示す Boolean 値を取得または設定します。 |
![]() | Name | コンテキスト属性の名前を取得します。(ContextAttribute から継承されます。) |
![]() | TypeId | 派生クラスに実装されている場合は、この Attribute の一意の識別子を取得します。(Attribute から継承されます。) |


名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 (Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 (Object から継承されます。) |

Weblioに収録されているすべての辞書からSynchronizationAttributeを検索する場合は、下記のリンクをクリックしてください。

- SynchronizationAttributeのページへのリンク