CallContext.FreeNamedDataSlot メソッドとは? わかりやすく解説

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

CallContext.FreeNamedDataSlot メソッド

指定した名前のデータ スロットを空にします。

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

Public Shared Sub FreeNamedDataSlot
 ( _
    name As String _
)
Dim name As String

CallContext.FreeNamedDataSlot(name)
public static void FreeNamedDataSlot
 (
    string name
)
public:
static void FreeNamedDataSlot (
    String^ name
)
public static void FreeNamedDataSlot
 (
    String name
)
public static function FreeNamedDataSlot
 (
    name : String
)

パラメータ

name

空にするデータ スロットの名前。

例外例外
使用例使用例

前付データ スロット作成しリモート オブジェクトメソッド呼び出すクライアントコード例次に示します。このメソッドは、論理スレッドから返された名前付データ スロットの値を表示し、その名前付データ スロット解放します。

' Register the channel.
Dim myChannel As New TcpChannel()
ChannelServices.RegisterChannel(myChannel)
RemotingConfiguration.RegisterActivatedClientType(GetType(HelloService),
 "Tcp://localhost:8082")


Dim myIdentity As New GenericIdentity("Bob")
Dim myPrincipal As New GenericPrincipal(myIdentity,
 New String() {"Level1"})
Dim myData As New MyLogicalCallContextData(myPrincipal)

' Set DataSlot with name parameter.
CallContext.SetData("test data", myData)

' Create a remote object.
Dim myService As New HelloService()
If myService Is Nothing
 Then
   Console.WriteLine("Cannot locate server.")
   return
End If

' Call the Remote methods.
Console.WriteLine("Remote method output is " + myService.HelloMethod("Microsoft"))

Dim myReturnData As MyLogicalCallContextData
 = _
                  CType(CallContext.GetData("test data"),
 MyLogicalCallContextData)

If myReturnData Is Nothing
 Then
   Console.WriteLine("Data is null.")
Else
   Console.WriteLine("Data is '{0}'", myReturnData.numOfAccesses)
End If 

' DataSlot with same Name Parameter which was Set is Freed.
CallContext.FreeNamedDataSlot("test data")
Dim myReturnData1 As MyLogicalCallContextData
 = _
                  CType(CallContext.GetData("test data"),
 MyLogicalCallContextData)

If myReturnData1 Is Nothing
 Then
   Console.WriteLine("FreeNamedDataSlot Successful for test data")
Else
   Console.WriteLine("FreeNamedDataSlot Failed  for test data")
End If 
// Register the channel.
TcpChannel myChannel = new TcpChannel ();
ChannelServices.RegisterChannel(myChannel);
RemotingConfiguration.RegisterActivatedClientType(typeof(HelloService),"Tcp://localhost:8082");


GenericIdentity myIdentity = new GenericIdentity("Bob");
GenericPrincipal myPrincipal = new GenericPrincipal(myIdentity,new
 string[] {"Level1"});
MyLogicalCallContextData myData = new MyLogicalCallContextData(myPrincipal);

// Set DataSlot with name parameter.
CallContext.SetData("test data",myData);

// Create a remote object.
HelloService myService = new HelloService();
if (myService == null)
{
   Console.WriteLine("Cannot locate server.");
   return;
}

// Call the Remote methods.
Console.WriteLine("Remote method output is " + myService.HelloMethod("Microsoft"));

MyLogicalCallContextData myReturnData =
                           (MyLogicalCallContextData) CallContext.GetData("test
 data");
if (myReturnData == null )
   Console.WriteLine("Data is null.");
else
   Console.WriteLine("Data is '{0}'", myReturnData.numOfAccesses);

// DataSlot with same Name Parameter which was Set is Freed.
CallContext.FreeNamedDataSlot("test data");
MyLogicalCallContextData myReturnData1 =
                        (MyLogicalCallContextData) CallContext.GetData("test
 data");
if (myReturnData1 == null )
   Console.WriteLine("FreeNamedDataSlot Successful for test
 data");
else
   Console.WriteLine("FreeNamedDataSlot Failed  for test
 data");
// Register the channel.
TcpChannel^ myChannel = gcnew TcpChannel;
ChannelServices::RegisterChannel( myChannel );
RemotingConfiguration::RegisterActivatedClientType( HelloService::typeid, "Tcp://localhost:8082"
 );

GenericIdentity^ myIdentity = gcnew GenericIdentity( "Bob" );
array<String^>^ idStr = gcnew array<String^>(1);
idStr[ 0 ] = "Level1";
GenericPrincipal^ myPrincipal = gcnew GenericPrincipal( myIdentity, idStr );
MyLogicalCallContextData ^ myData = gcnew MyLogicalCallContextData( myPrincipal );

// Set DataSlot with name parameter.
CallContext::SetData( "test data", myData );

// Create a remote Object*.
HelloService ^ myService = gcnew HelloService;
if ( myService == nullptr )
{
   Console::WriteLine( "Cannot locate server." );
   return  -1;
}

// Call the Remote methods.
Console::WriteLine( "Remote method output is {0}", myService->HelloMethod(
 "Microsoft" ) );

MyLogicalCallContextData ^ myReturnData =
   (MyLogicalCallContextData^)( CallContext::GetData( "test data" ) );
if ( myReturnData == nullptr )
{
   Console::WriteLine( "Data is 0." );
}
else
{
   Console::WriteLine( "Data is ' {0}'", myReturnData->numOfAccesses
 );
}

// DataSlot with same Name Parameter which was Set is Freed.
CallContext::FreeNamedDataSlot( "test data" );
MyLogicalCallContextData ^ myReturnData1 =
   (MyLogicalCallContextData^)( CallContext::GetData( "test data" ) );
if ( myReturnData1 == nullptr )
{
   Console::WriteLine( "FreeNamedDataSlot Successful for
 test data" );
}
else
{
   Console::WriteLine( "FreeNamedDataSlot Failed  for test
 data" );
}
.NET Framework のセキュリティ.NET Frameworkセキュリティ
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
CallContext クラス
CallContext メンバ
System.Runtime.Remoting.Messaging 名前空間


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

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

辞書ショートカット

すべての辞書の索引

CallContext.FreeNamedDataSlot メソッドのお隣キーワード
検索ランキング

   

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



CallContext.FreeNamedDataSlot メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2025 GRAS Group, Inc.RSS