SynchronizationAttribute クラスとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > SynchronizationAttribute クラスの意味・解説 

SynchronizationAttribute クラス

コンポーネント同期値を設定します。このクラス継承できません。

名前空間: System.EnterpriseServices
アセンブリ: System.EnterpriseServices (system.enterpriseservices.dll 内)
構文構文

<ComVisibleAttribute(False)> _
<AttributeUsageAttribute(AttributeTargets.Class, Inherited:=True)> _
Public NotInheritable Class
 SynchronizationAttribute
    Inherits Attribute
Dim instance As SynchronizationAttribute
[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
/** @attribute ComVisibleAttribute(false) */ 
/** @attribute AttributeUsageAttribute(AttributeTargets.Class, Inherited=true)
 */ 
public final class SynchronizationAttribute
 extends Attribute
ComVisibleAttribute(false) 
AttributeUsageAttribute(AttributeTargets.Class, Inherited=true)
 
public final class SynchronizationAttribute
 extends Attribute
解説解説
使用例使用例

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.Object
   System.Attribute
    System.EnterpriseServices.SynchronizationAttribute
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

SynchronizationAttribute クラス

現在のコンテキスト、および同じインスタンス共有するすべてのコンテキスト同期ドメイン適用します。

名前空間: System.Runtime.Remoting.Contexts
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

<SerializableAttribute> _
<AttributeUsageAttribute(AttributeTargets.Class)> _
<ComVisibleAttribute(True)> _
Public Class SynchronizationAttribute
    Inherits ContextAttribute
    Implements IContributeServerContextSink, IContributeClientContextSink
Dim instance As SynchronizationAttribute
[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
/** @attribute SerializableAttribute() */ 
/** @attribute AttributeUsageAttribute(AttributeTargets.Class) */ 
/** @attribute ComVisibleAttribute(true) */ 
public class SynchronizationAttribute extends
 ContextAttribute implements IContributeServerContextSink, IContributeClientContextSink
SerializableAttribute 
AttributeUsageAttribute(AttributeTargets.Class) 
ComVisibleAttribute(true) 
public class SynchronizationAttribute extends
 ContextAttribute implements 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
.NET Framework のセキュリティ.NET Frameworkセキュリティ
継承階層継承階層
System.Object
   System.Attribute
     System.Runtime.Remoting.Contexts.ContextAttribute
      System.Runtime.Remoting.Contexts.SynchronizationAttribute
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
SynchronizationAttribute メンバ
System.Runtime.Remoting.Contexts 名前空間


このページでは「.NET Framework クラス ライブラリ リファレンス」からSynchronizationAttribute クラスを検索した結果を表示しています。
Weblioに収録されているすべての辞書からSynchronizationAttribute クラスを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からSynchronizationAttribute クラス を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「SynchronizationAttribute クラス」の関連用語

SynchronizationAttribute クラスのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



SynchronizationAttribute クラスのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS