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

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

SocketPermission.IsSubsetOf メソッド

現在のアクセス許可が、指定したアクセス許可サブセットかどうか判断します

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

Public Overrides Function
 IsSubsetOf ( _
    target As IPermission _
) As Boolean
Dim instance As SocketPermission
Dim target As IPermission
Dim returnValue As Boolean

returnValue = instance.IsSubsetOf(target)
public override bool IsSubsetOf (
    IPermission target
)
public:
virtual bool IsSubsetOf (
    IPermission^ target
) override
public boolean IsSubsetOf (
    IPermission target
)
public override function IsSubsetOf (
    target : IPermission
) : boolean

パラメータ

target

サブセットの関係を調べ対象の SocketPermission。

戻り値
targetnull 参照 (Visual Basic では Nothing) で、現在のインスタンスアクセス許可定義してない場合、このメソッドtrue返しますそれ以外場合は、false返しますtargetnull 参照 (Visual Basic では Nothing) ではなく現在のインスタンスtargetアクセス許可サブセット定義している場合は、true返しますそれ以外場合false返します

例外例外
例外種類条件

ArgumentException

target が SocketException ではありません。

SecurityException

DnsPermission が、メソッド呼び出し側では付与されていません。

解説解説
使用例使用例

ある SocketPermission が他のサブセットかどうかを、IsSubsetOf メソッド使用して確認する例を次に示します

' Creates a SocketPermission restricting access to and from all URIs.
Dim mySocketPermission1 As New
 SocketPermission(PermissionState.None)

' The socket to which this permission will apply will allow connections
 from www.contoso.com.
mySocketPermission1.AddPermission(NetworkAccess.Accept, TransportType.Tcp, "www.contoso.com",
 11000)

' Creates a SocketPermission which will allow the target Socket to connect
 with www.southridgevideo.com.
Dim mySocketPermission2 As New
 SocketPermission(NetworkAccess.Connect, TransportType.Tcp, "www.southridgevideo.com",
 11002)

' Creates a SocketPermission from the union of two SocketPermissions.
Dim mySocketPermissionUnion As SocketPermission
 = CType(mySocketPermission1.Union(mySocketPermission2), SocketPermission)

' Checks to see if the union was successfully created by using the IsSubsetOf
 method.
If mySocketPermission1.IsSubsetOf(mySocketPermissionUnion) And
 mySocketPermission2.IsSubsetOf(mySocketPermissionUnion) Then
   Console.WriteLine("This union contains permissions from both
 mySocketPermission1 and mySocketPermission2")
   
   ' Prints the allowable accept URIs to the console.
   Console.WriteLine("This union accepts connections on :")
   
   Dim myEnumerator As IEnumerator = mySocketPermissionUnion.AcceptList
   While myEnumerator.MoveNext()
      Console.WriteLine(CType(myEnumerator.Current, EndpointPermission).ToString())
   End While
   
   Console.WriteLine("This union establishes connections on :
 ")
   
   ' Prints the allowable connect URIs to the console.
   Console.WriteLine("This union permits connections to :")
   
   myEnumerator = mySocketPermissionUnion.ConnectList
   While myEnumerator.MoveNext()
      Console.WriteLine(CType(myEnumerator.Current, EndpointPermission).ToString())
   End While
End If 
// Creates a SocketPermission restricting access to and from all URIs.
SocketPermission mySocketPermission1 = new SocketPermission(PermissionState.None);

// The socket to which this permission will apply will allow connections
 from www.contoso.com.
mySocketPermission1.AddPermission(NetworkAccess.Accept, TransportType.Tcp, "www.contoso.com",
 11000);

// Creates a SocketPermission which will allow the target Socket to
 connect with www.southridgevideo.com.
SocketPermission mySocketPermission2 =
                           new SocketPermission(NetworkAccess.Connect,
 TransportType.Tcp, "www.southridgevideo.com", 11002);

// Creates a SocketPermission from the union of two SocketPermissions.
SocketPermission mySocketPermissionUnion = 
                           (SocketPermission)mySocketPermission1.Union(mySocketPermission2);

// Checks to see if the union was successfully created by using the
 IsSubsetOf method.
if (mySocketPermission1.IsSubsetOf(mySocketPermissionUnion) &&
 
       mySocketPermission2.IsSubsetOf(mySocketPermissionUnion)){
     Console.WriteLine("This union contains permissions from both mySocketPermission1
 and mySocketPermission2"); 

     // Prints the allowable accept URIs to the console.
     Console.WriteLine("This union accepts connections on :");

     IEnumerator myEnumerator = mySocketPermissionUnion.AcceptList;
  while (myEnumerator.MoveNext()) {
          Console.WriteLine(((EndpointPermission)myEnumerator.Current).ToString());
       }      

        // Prints the allowable connect URIs to the console.
     Console.WriteLine("This union permits connections to :");

     myEnumerator = mySocketPermissionUnion.ConnectList;
  while (myEnumerator.MoveNext()) {
          Console.WriteLine(((EndpointPermission)myEnumerator.Current).ToString());
       }      

      }

// Creates a SocketPermission restricting access to and from all URIs.
SocketPermission^ mySocketPermission1 = gcnew SocketPermission( PermissionState::None
 );

// The socket to which this permission will apply will allow connections
 from www.contoso.com.
mySocketPermission1->AddPermission( NetworkAccess::Accept, TransportType::Tcp,
  "www.contoso.com", 11000 );

// Creates a SocketPermission which will allow the target Socket to
 connect with www.southridgevideo.com.
SocketPermission^ mySocketPermission2 = gcnew SocketPermission( NetworkAccess::Connect,TransportType::Tcp,
 "www.southridgevideo.com",11002 );

// Creates a SocketPermission from the union of two SocketPermissions.
SocketPermission^ mySocketPermissionUnion =
   (SocketPermission^)( mySocketPermission1->Union( mySocketPermission2 ) );

// Checks to see if the union was successfully created by using the
 IsSubsetOf method.
if ( mySocketPermission1->IsSubsetOf( mySocketPermissionUnion
 ) &&
   mySocketPermission2->IsSubsetOf( mySocketPermissionUnion ) )
{
   Console::WriteLine(  "This union contains permissions from both mySocketPermission1
 and mySocketPermission2" );
   
   // Prints the allowable accept URIs to the console.
   Console::WriteLine(  "This union accepts connections on :" );

   IEnumerator^ myEnumerator = mySocketPermissionUnion->AcceptList;
   while ( myEnumerator->MoveNext() )
   {
      Console::WriteLine( safe_cast<EndpointPermission^>( myEnumerator->Current
 )->ToString() );
   }
   
   // Prints the allowable connect URIs to the console.
   Console::WriteLine(  "This union permits connections to :" );

   myEnumerator = mySocketPermissionUnion->ConnectList;
   while ( myEnumerator->MoveNext() )
   {
      Console::WriteLine( safe_cast<EndpointPermission^>( myEnumerator->Current
 )->ToString() );
   }
}
// Creates a SocketPermission restricting access to and from all URIs.
SocketPermission mySocketPermission1 
    = new SocketPermission(PermissionState.None);
// The socket to which this permission will apply will allow 
// connections from www.contoso.com.
mySocketPermission1.AddPermission(NetworkAccess.Accept, 
    TransportType.Tcp, "www.contoso.com", 11000);
// Creates a SocketPermission which will allow the target Socket to
 
// connect with www.southridgevideo.com.
SocketPermission mySocketPermission2 
    = new SocketPermission(NetworkAccess.Connect, 
    TransportType.Tcp, "www.southridgevideo.com", 11002);
// Creates a SocketPermission from the union of two SocketPermissions.
SocketPermission mySocketPermissionUnion 
    = (SocketPermission)mySocketPermission1.Union(mySocketPermission2);
// Checks to see if the union was successfully created by using the
 
// IsSubsetOf method.
if (mySocketPermission1.IsSubsetOf(mySocketPermissionUnion) 
    && mySocketPermission2.IsSubsetOf(mySocketPermissionUnion)) {
    Console.WriteLine("This union contains permissions from both "    
                             + "mySocketPermission1 and mySocketPermission2");
    // Prints the allowable accept URIs to the console.
    Console.WriteLine("This union accepts connections on :");

    IEnumerator myEnumerator = mySocketPermissionUnion.
        get_AcceptList();
    while (myEnumerator.MoveNext()) {
        Console.WriteLine(((EndpointPermission)myEnumerator.
            get_Current()).ToString());
    }
    // Prints the allowable connect URIs to the console.
    Console.WriteLine("This union permits connections to :");

    myEnumerator = mySocketPermissionUnion.get_ConnectList();
    while (myEnumerator.MoveNext()) {
        Console.WriteLine(((EndpointPermission)myEnumerator.
            get_Current()).ToString());
    }
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
SocketPermission クラス
SocketPermission メンバ
System.Net 名前空間


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

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

辞書ショートカット

すべての辞書の索引

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

   

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



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

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

©2025 GRAS Group, Inc.RSS