次の方法で共有


ZoneIdentityPermission.SecurityZone プロパティ

現在の ZoneIdentityPermission で表されるゾーンを取得または設定します。

Public Property SecurityZone As SecurityZone
[C#]
public SecurityZone SecurityZone {get; set;}
[C++]
public: __property SecurityZone get_SecurityZone();public: __property void set_SecurityZone(SecurityZone);
[JScript]
public function get SecurityZone() : SecurityZone;public function set SecurityZone(SecurityZone);

プロパティ値

SecurityZone 値の 1 つ。

例外

例外の種類 条件
ArgumentException パラメータ値が SecurityZone の有効値ではありません。

使用例

 
' IsSubsetOf determines whether the current permission is a subset of the specified permission.
Private Function IsSubsetOfDemo() As Boolean
    Dim returnValue As Boolean = True
    Dim zone1, zone2 As SecurityZone
    Dim zoneIdPerm1, zoneIdPerm2 As ZoneIdentityPermission
    Dim zoneGen1 As New zoneGenerator()
    Dim zoneGen2 As New zoneGenerator()
    zoneGen1.ResetIndex()
    While zoneGen1.CreateZone(zoneIdPerm1, zone1)
        If zoneIdPerm1 Is Nothing Then
            GoTo ContinueWhile1
        End If
        zoneGen2.ResetIndex()
        Console.WriteLine("********************************************************" & ControlChars.Cr)

        While zoneGen2.CreateZone(zoneIdPerm2, zone2)
            If zoneIdPerm2 Is Nothing Then
                GoTo ContinueWhile2
            End If
            Try
                If zoneIdPerm1.IsSubsetOf(zoneIdPerm2) Then
                    Console.WriteLine((zoneIdPerm1.SecurityZone.ToString() & _
                    " is a subset of " & zoneIdPerm2.SecurityZone.ToString()))
                Else
                    Console.WriteLine((zoneIdPerm1.SecurityZone.ToString() & _
                    " is not a subset of " & zoneIdPerm2.SecurityZone.ToString()))
                End If
            Catch e As Exception
                Console.WriteLine(("An exception was thrown for subset :" & _
                zoneIdPerm1.ToString() & ControlChars.Cr & zoneIdPerm2.ToString() & _
                ControlChars.Cr & e.ToString()))
                returnValue = False
            End Try
ContinueWhile2:
        End While
ContinueWhile1:
    End While
    Return returnValue
End Function 'IsSubsetOfDemo


[C#] 
// IsSubsetOf determines whether the current permission is a subset of the specified permission.
    private bool IsSubsetOfDemo()
    {
        bool returnValue = true;
        SecurityZone zone1,zone2;
        ZoneIdentityPermission zoneIdPerm1,zoneIdPerm2;
        ZoneGenerator zoneGen1 = new ZoneGenerator();
        ZoneGenerator zoneGen2 = new ZoneGenerator();
        zoneGen1.ResetIndex();
        while(zoneGen1.CreateZone(out zoneIdPerm1, out zone1)) 
        {
            if(zoneIdPerm1 == null) continue;
            zoneGen2.ResetIndex();
            Console.WriteLine("********************************************************\n");

            while(zoneGen2.CreateZone(out zoneIdPerm2, out zone2)) 
            {
                if(zoneIdPerm2 == null) continue;
                try
                {            
                    if (zoneIdPerm1.IsSubsetOf(zoneIdPerm2))
                    {
                        Console.WriteLine(zoneIdPerm1.SecurityZone + " is a subset of " + 
                            zoneIdPerm2.SecurityZone);
                    }
                    else
                    {
                        Console.WriteLine(zoneIdPerm1.SecurityZone + " is not a subset of " + 
                            zoneIdPerm2.SecurityZone);
                    }
                }
                catch(Exception e) 
                {
                    Console.WriteLine("An exception was thrown for subset :" + zoneIdPerm1 + "\n" + 
                        zoneIdPerm2 +"\n" + e);
                    returnValue=false;
                }
            }
        }
        return returnValue;
    }

[C++] 
// IsSubsetOf determines whether the current permission is a subset of the specified permission.
private:
bool IsSubsetOfDemo() {
   bool returnValue = true;
   SecurityZone zone1, zone2;
   ZoneIdentityPermission* zoneIdPerm1, * zoneIdPerm2;
   ZoneGenerator* zoneGen1 = new ZoneGenerator();
   ZoneGenerator* zoneGen2 = new ZoneGenerator();
   zoneGen1->ResetIndex();
   while(zoneGen1->CreateZone(&zoneIdPerm1, &zone1)) {
      if (zoneIdPerm1 == 0) continue;
      zoneGen2->ResetIndex();
      Console::WriteLine(S"********************************************************\n");

      while(zoneGen2->CreateZone(&zoneIdPerm2, &zone2)) {
         if (zoneIdPerm2 == 0) continue;
         try {
            if (zoneIdPerm1->IsSubsetOf(zoneIdPerm2)) {
               Console::WriteLine(S"{0} is a subset of {1}",
                  __box(zoneIdPerm1->SecurityZone), __box(zoneIdPerm2->SecurityZone));
            } else {
               Console::WriteLine(S"{0} is not a subset of {1}",
                  __box(zoneIdPerm1->SecurityZone), __box(zoneIdPerm2->SecurityZone));
            }
         } catch (Exception* e) {
            Console::WriteLine(S"An exception was thrown for subset : {0}\n{1}\n{2}",
               zoneIdPerm1, zoneIdPerm2, e);
            returnValue=false;
         }
      }
   }
   return returnValue;
}

[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ

参照

ZoneIdentityPermission クラス | ZoneIdentityPermission メンバ | System.Security.Permissions 名前空間