GacIdentityPermission.Copy メソッド
アセンブリ: mscorlib (mscorlib.dll 内)
構文
Dim instance As GacIdentityPermission Dim returnValue As IPermission returnValue = instance.Copy
現在のアクセス許可のコピー。
使用例
Copy メソッドを使用するコード例を次に示します。このコード例は、GacIdentityPermission クラスのトピックで取り上げているコード例の一部分です。
'Copy creates and returns an identical copy of the current permission. Private Function CopyDemo() As Boolean Dim Gac1 As New GacIdentityPermission Dim Gac2 As New GacIdentityPermission Console.WriteLine("**************************************************************************") Try Gac2 = CType(Gac1.Copy(), GacIdentityPermission) If Not (Gac2 Is Nothing) Then Console.WriteLine(("Result of copy = " & Gac2.ToString() & ControlChars.Lf)) End If Catch e As Exception Console.WriteLine(("Copy failed : " & Gac1.ToString() & e.ToString())) Return False End Try Return True End Function 'CopyDemo
//Copy creates and returns an identical copy of the current permission. private bool CopyDemo() { GacIdentityPermission Gac1 = new GacIdentityPermission(); GacIdentityPermission Gac2 = new GacIdentityPermission(); Console.WriteLine("**************************************************************************"); try { Gac2 = (GacIdentityPermission)Gac1.Copy(); if (Gac2 != null) { Console.WriteLine("Result of copy = " + Gac2.ToString() + "\n"); } } catch (Exception e) { Console.WriteLine("Copy failed : " + Gac1.ToString() + e); return false; } return true; }
//Copy creates and returns an identical copy of the current permission. bool CopyDemo() { GacIdentityPermission ^ Gac1 = gcnew GacIdentityPermission; GacIdentityPermission ^ Gac2 = gcnew GacIdentityPermission; Console::WriteLine( "**************************************************************************" ); try { Gac2 = dynamic_cast<GacIdentityPermission^>(Gac1->Copy()); if ( Gac2 != nullptr ) { Console::WriteLine( "Result of copy = {0}\n", Gac2 ); } } catch ( Exception^ e ) { Console::WriteLine( "Copy failed : {0}{1}", Gac1, e ); return false; } return true; }
// Copy creates and returns an identical copy of the current permission. private boolean CopyDemo() { GacIdentityPermission gac1 = new GacIdentityPermission(); GacIdentityPermission gac2 = new GacIdentityPermission(); Console.WriteLine("****************************************" + "**********************************"); try { gac2 = ((GacIdentityPermission)(gac1.Copy())); if (gac2 != null) { Console.WriteLine(("Result of copy = " + gac2.ToString() + "\n")); } } catch (System.Exception e) { Console.WriteLine(("Copy failed : " + gac1.ToString() + e)); return false; } return true; } //CopyDemo
Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
参照
- GacIdentityPermission.Copy メソッドのページへのリンク