UrlIdentityPermission.Copy メソッド
アセンブリ: mscorlib (mscorlib.dll 内)

Dim instance As UrlIdentityPermission Dim returnValue As IPermission returnValue = instance.Copy
現在のアクセス許可のコピー。


'Copy creates and returns an identical copy of the current permission. Private Function CopyDemo() As Boolean Dim returnValue As Boolean = True Dim url1 As String = "" Dim url2 As String = "" Dim urlIdPerm1, urlIdPerm2 As UrlIdentityPermission Dim urlGen1 As New UrlGenerator() Dim urlGen2 As New UrlGenerator() urlGen1.ResetIndex() While urlGen1.CreateUrl(url1) urlIdPerm1 = New UrlIdentityPermission(url1) urlGen2.ResetIndex() Console.WriteLine("********************************************************\n") Try urlIdPerm2 = CType(urlIdPerm1.Copy(), UrlIdentityPermission) If Not (urlIdPerm2 Is Nothing) Then Console.WriteLine("Result of copy = " & urlIdPerm2.ToString() & ControlChars.Lf) Else Console.WriteLine("Result of copy is null. " & ControlChars.Lf) End If Catch e As Exception If (True.ToString()) Then If url1 = "" Then Console.WriteLine("The target UrlIdentityPermission is empty; copy failed.") Else Console.WriteLine(e.ToString()) End If End If GoTo ContinueWhile1 End Try ContinueWhile1: End While Return returnValue End Function 'CopyDemo
//Copy creates and returns an identical copy of the current permission. private bool CopyDemo() { bool returnValue = true; string url1; UrlIdentityPermission urlIdPerm1, urlIdPerm2; UrlGenerator urlGen1 = new UrlGenerator(); UrlGenerator urlGen2 = new UrlGenerator(); urlGen1.ResetIndex(); while (urlGen1.CreateUrl(out url1)) { urlIdPerm1 = new UrlIdentityPermission(url1); urlGen2.ResetIndex(); Console.WriteLine("********************************************************\n"); try { urlIdPerm2 = (UrlIdentityPermission)urlIdPerm1.Copy(); if (urlIdPerm2 != null) { Console.WriteLine("Result of copy = " + urlIdPerm2.ToString() + "\n"); } else { Console.WriteLine("Result of copy is null. \n"); } } catch (Exception e) { { if (url1 == "") { Console.WriteLine("The target UrlIdentityPermission is empty; copy failed."); } else Console.WriteLine(e); } continue; } } return returnValue; }
//Copy creates and returns an identical copy of the current permission. private boolean CopyDemo() { boolean returnValue = true; String url1[] = new String[1]; UrlIdentityPermission urlIdPerm1[] = new UrlIdentityPermission[1]; UrlIdentityPermission urlIdPerm2[] = new UrlIdentityPermission[1]; UrlGenerator urlGen1 = new UrlGenerator(); UrlGenerator urlGen2 = new UrlGenerator(); urlGen1.ResetIndex(); while (urlGen1.CreateUrl(urlIdPerm1, url1)) { if (urlIdPerm1 == null) { continue; } urlGen2.ResetIndex(); Console.WriteLine("**********************************************" + "**********\n"); try { urlIdPerm2[0] = ((UrlIdentityPermission)(urlIdPerm1[0].Copy())); if (urlIdPerm2 != null) { Console.WriteLine(("Result of copy = " + urlIdPerm2[0]. ToString() + "\n")); } else { Console.WriteLine("Result of copy is null. \n"); } } catch (System.Exception e) { { if (url1[0].Equals("")) { Console.WriteLine("The target UrlIdentityPermission" + " is empty; copy failed."); } else { Console.WriteLine(e); } } continue; } } return returnValue; } //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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


- UrlIdentityPermission.Copy メソッドのページへのリンク