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

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

FileIOPermission.Union メソッド

現在のアクセス許可指定したアクセス許可和集合を表すアクセス許可作成します

名前空間: System.Security.Permissions
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

Public Overrides Function
 Union ( _
    other As IPermission _
) As IPermission
Dim instance As FileIOPermission
Dim other As IPermission
Dim returnValue As IPermission

returnValue = instance.Union(other)
public override IPermission Union (
    IPermission other
)
public:
virtual IPermission^ Union (
    IPermission^ other
) override
public IPermission Union (
    IPermission other
)
public override function Union (
    other : IPermission
) : IPermission

パラメータ

other

現在のアクセス許可和集合を持つアクセス許可。これは、現在のアクセス許可と同じ型であることが必要です。

戻り値
現在のアクセス許可指定したアクセス許可和集合を表す新しアクセス許可

例外例外
例外種類条件

ArgumentException

other パラメータnull 参照 (Visual Basic では Nothing) ではなく現在のアクセス許可と同じ型でもありません。

解説解説
使用例使用例
    Private Function UnionDemo() As
 Boolean

        Dim returnValue As Boolean
 = True

        Dim fileIO1 As String
 = ""
        Dim fileIO2 As String
 = ""
        Dim fileIOPerm1, fileIOPerm2 As FileIOPermission
        Dim fileIOPerm3 As IPermission

        Dim fileIOGen1 As New
 FileIOGenerator()
        Dim fileIOGen2 As New
 FileIOGenerator()

        fileIOGen1.ResetIndex()
        While fileIOGen1.CreateFilePath(fileIO1)
            If fileIO1 = "" Then
                fileIOPerm1 = New FileIOPermission(PermissionState.None)
            Else
                fileIOPerm1 = New FileIOPermission(FileIOPermissionAccess.Read,
 fileIO1)
            End If
            Console.WriteLine("**********************************************************"
 & ControlChars.Lf)
            fileIOGen2.ResetIndex()

            While fileIOGen2.CreateFilePath(fileIO2)

                Try
                    If fileIO2 = ""
 Then
                        fileIOPerm2 = New FileIOPermission(PermissionState.None)
                    Else
                        fileIOPerm2 = New FileIOPermission(FileIOPermissionAccess.Read,
 fileIO2)
                    End If
                    Dim firstPermission As
 String = IIf(fileIO1 = "" Or
 fileIO1 Is Nothing, "null", fileIO1)
                    Dim secondPermission As
 String = IIf(fileIO2 = "" Or
 fileIO2 Is Nothing, "null", fileIO2)
                    fileIOPerm3 = CType(fileIOPerm1.Union(fileIOPerm2), FileIOPermission)
                    fileIOPerm3 = fileIOPerm1.Union(fileIOPerm2)

                    If fileIOPerm3 Is Nothing
 Then
                        Console.WriteLine(("The union of "
 & firstPermission & "  and " & secondPermission
 & " is null."))
                    Else
                        Console.WriteLine(("The union of "
 & firstPermission & "  and " & secondPermission
 & " = " & ControlChars.Lf & ControlChars.Tab & CType(fileIOPerm3, FileIOPermission).GetPathList(FileIOPermissionAccess.Read)(0)))
                    End If
                Catch e As Exception
                    Console.WriteLine(("An exception was thrown
 for union " & e.ToString()))
                    returnValue = False
                End Try
ContinueWhile2:
            End While
ContinueWhile1:
        End While


        Return returnValue
    End Function 'UnionDemo
private bool UnionDemo()
{

    bool returnValue = true;

    string fileIO1, fileIO2;
    FileIOPermission fileIOPerm1, fileIOPerm2;
    IPermission fileIOPerm3;

    FileIOGenerator fileIOGen1 = new FileIOGenerator();
    FileIOGenerator fileIOGen2 = new FileIOGenerator();

    fileIOGen1.ResetIndex();
    while (fileIOGen1.CreateFilePath( out fileIO1 ))
    {
        if (fileIO1 == "")
            fileIOPerm1 = new FileIOPermission(PermissionState.None);
        else
        fileIOPerm1 = new FileIOPermission(FileIOPermissionAccess.Read,
 fileIO1);
        if (fileIO1 == null) continue;

        Console.WriteLine("**********************************************************\n");
        fileIOGen2.ResetIndex();

        while (fileIOGen2.CreateFilePath( out fileIO2 ))
        {
            if (fileIO2 == "")
                fileIOPerm2 = new FileIOPermission(PermissionState.None);
            else
                fileIOPerm2 = new FileIOPermission(FileIOPermissionAccess.Read,
 fileIO2);
            try
            {
                string firstPermission = fileIO1 == ""
 | fileIO1 == null ? "null" : fileIO1;
                string secondPermission = fileIO2 == ""
 | fileIO2 == null ? "null" : fileIO2;
                fileIOPerm3 = (FileIOPermission)fileIOPerm1.Union(fileIOPerm2);
                fileIOPerm3 = fileIOPerm1.Union(fileIOPerm2);

                if (fileIOPerm3 == null)
                {
                    Console.WriteLine("The union of " + firstPermission
 + " and " + secondPermission + " is null.");
                }
                else
                {
                    Console.WriteLine("The union of " + firstPermission
 + " and " + secondPermission +
                        " = \n\t" + ((FileIOPermission)fileIOPerm3).GetPathList(FileIOPermissionAccess.Read)[0]);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("An exception was thrown for
 union " + e);
                returnValue = false;
            }

        }

    }

    return returnValue;

}
bool UnionDemo()
{
   bool returnValue = true;
   String^ fileIO1;
   String^ fileIO2;
   FileIOPermission^ fileIOPerm1;
   FileIOPermission^ fileIOPerm2;
   IPermission^ fileIOPerm3;
   FileIOGenerator^ fileIOGen1 = gcnew FileIOGenerator;
   FileIOGenerator^ fileIOGen2 = gcnew FileIOGenerator;
   fileIOGen1->ResetIndex();
   while ( fileIOGen1->CreateFilePath(  &fileIO1 ) )
   {
      if (fileIO1 == "")
          fileIOPerm1 = gcnew FileIOPermission(PermissionState::None);
       else
           fileIOPerm1 = gcnew FileIOPermission(FileIOPermissionAccess::Read, fileIO1);

      Console::WriteLine( "**********************************************************\n"
 );
      fileIOGen2->ResetIndex();
      while ( fileIOGen2->CreateFilePath(  &fileIO2 ) )
      {
          if (fileIO2 == "")
              fileIOPerm2 = gcnew FileIOPermission(PermissionState::None);
         else
           fileIOPerm2 = gcnew FileIOPermission(FileIOPermissionAccess::Read, fileIO2);
         try
         {
            if ( fileIOPerm2 == nullptr )
                           continue;
            String^ firstPermission = fileIO1 == "" || fileIO1 == nullptr
 ? "null" : fileIO1;
            String^ secondPermission = fileIO2 == "" || fileIO2 == nullptr
 ? "null" : fileIO2;
            fileIOPerm3 = dynamic_cast<FileIOPermission^>(fileIOPerm1->Union(
 fileIOPerm2 ));
            fileIOPerm3 = fileIOPerm1->Union( fileIOPerm2 );
            if ( fileIOPerm3 == nullptr )
            {
               Console::WriteLine( "The union of {0}  and {1} is null.",
 firstPermission, secondPermission );
            }
            else
            {
               Console::WriteLine( "The union of {0}  and {1} = \n\t{2}",
 firstPermission, secondPermission, (dynamic_cast<FileIOPermission^>(fileIOPerm3))->GetPathList(
 FileIOPermissionAccess::Read )[ 0 ] );
            }
         }
         catch ( Exception^ e ) 
         {
            Console::WriteLine( "An exception was thrown for
 union {0}", e );
            returnValue = false;
         }

      }
   }

   return returnValue;
}


// Union creates a new permission that is the union of the current 
// permission and the specified permission.
private boolean UnionDemo() 
{
    boolean returnValue = true;
    String fileIO1[] = new String[1];
    String fileIO2[] = new String[1];
    FileIOPermission fileIOPerm1[] = new FileIOPermission[1];
    FileIOPermission fileIOPerm2[] = new FileIOPermission[1];
    
    IPermission fileIOPerm3;
    
    FileIOGenerator fileIOGen1 =  new FileIOGenerator();
    FileIOGenerator fileIOGen2 =  new FileIOGenerator();
    
    fileIOGen1.ResetIndex();
    while(fileIOGen1.CreateFilePath(fileIOPerm1, 
        fileIO1, FileIOPermissionAccess.Read)) {
        if (fileIO1[0] == null) {
            continue ;
        }
        Console.WriteLine("*****************************" 
            + "*****************************\n");
        fileIOGen2.ResetIndex();
        
        while(fileIOGen2.CreateFilePath(fileIOPerm2, 
            fileIO2, FileIOPermissionAccess.Read)) {
            try {
                if (fileIOPerm2[0] == null)
 {
                    continue ;
                }
                
                String firstPermission = (fileIO1[0].equals("")==
                    true | fileIO1[0] == null)
 ? "null" : fileIO1[0];
                String secondPermission = (fileIO2[0].equals("") == 
                    true | fileIO2[0] == null)
 ? "null" : fileIO2[0];
                fileIOPerm3 =((FileIOPermission)(fileIOPerm1[0].
                    Union(fileIOPerm2[0])));
                fileIOPerm3 = fileIOPerm1[0].Union(fileIOPerm2[0]);
                
                if (fileIOPerm3 == null) {
                    Console.WriteLine(("The union of " 
                        + firstPermission + " and " 
                        + secondPermission 
                        + " is null."));
                }
                else {
                    Console.WriteLine(("The union of " + firstPermission
 
                        + " and " + secondPermission + " = \n\t"
 
                        + ((FileIOPermission)(fileIOPerm3)).
                        GetPathList(FileIOPermissionAccess.Read).
                        get_Item( 0)));
                }
            }
            catch(System.Exception e) {
                Console.WriteLine(("An exception was " 
                    + "thrown for union " + e));
                returnValue = false;
            }
        }
    }
    return returnValue ;
} //UnionDemo    
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
FileIOPermission クラス
FileIOPermission メンバ
System.Security.Permissions 名前空間



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

辞書ショートカット

すべての辞書の索引

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

   

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



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

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

©2025 GRAS Group, Inc.RSS