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

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


Copy メソッドの使用方法を次のコード例に示します。このコード例は、IsolatedStorageFilePermission クラスのトピックで取り上げているコード例の一部分です。
Private Sub Copy_EqualsDemo() Console.WriteLine(ControlChars.Lf + "Copy_Equals demo.") Console.WriteLine("Creating the first IsolatedStorageFilePermission(PermissionState.Unrestricted) permission.") Dim first As New IsolatedStorageFilePermission(PermissionState.Unrestricted) Console.WriteLine(("Hashcode for the first permission : " + first.GetHashCode().ToString())) Console.WriteLine("Copying the first permission.") Dim copyOfFirst As IsolatedStorageFilePermission = CType(first.Copy(), IsolatedStorageFilePermission) Console.WriteLine(("Hashcode for copy of the first permission: " + copyOfFirst.GetHashCode().ToString())) If False = copyOfFirst.Equals(first) Then ' This should be false, because the object references are different. Console.WriteLine(("The copy and the first permission should not be equal because they have " + ControlChars.Lf + ControlChars.Tab + "different object references.")) Else Console.WriteLine(("Error: the copy and the first permission should not be equal because they have " + ControlChars.Lf + ControlChars.Tab + "different object references.")) End If Console.WriteLine(("Does a comparison of copy of first permission to itself test equal??: " + IIf(copyOfFirst.Equals(copyOfFirst), "true", "false"))) If False = copyOfFirst.Equals(copyOfFirst) Then Console.WriteLine("Copy_Equals demo failed because Equals returns false on two object.Equals(itself).") End If Console.WriteLine(("Does a comparison of first permission to itself test equal?: " + IIf(first.Equals(first), "true", "false"))) If False = first.Equals(first) Then Console.WriteLine("Copy_Equals demo failed, because Equals returns false on two object.Equals(itself).") End If Console.WriteLine("Creating a second permission with PermissionState.None.") Dim second As New IsolatedStorageFilePermission(PermissionState.None) Console.WriteLine(("Does the first permission equal the second permission?: " + IIf(first.Equals(second), "true", "false"))) If True = first.Equals(second) Then Console.WriteLine("Copy_Equals demo failed because Equals returns false on two object.Equals(itself).") End If End Sub 'Copy_EqualsDemo
private void Copy_EqualsDemo() { Console.WriteLine ("\nCopy_Equals demo."); Console.WriteLine ("Creating the first IsolatedStorageFilePermission(PermissionState.Unrestricted) permission."); IsolatedStorageFilePermission first = new IsolatedStorageFilePermission(PermissionState.Unrestricted); Console.WriteLine ("Hashcode for the first permission : " + first.GetHashCode().ToString()); Console.WriteLine ("Copying the first permission."); IsolatedStorageFilePermission copyOfFirst = (IsolatedStorageFilePermission)first.Copy(); Console.WriteLine ("Hashcode for copy of the first permission: " + copyOfFirst.GetHashCode().ToString()); if (false == copyOfFirst.Equals(first)) // This should be false, because the object references are different. { Console.WriteLine ("The copy and the first permission should not be equal because they have " + "\n\tdifferent object references."); } else { Console.WriteLine ("Error: the copy and the first permission should not be equal because they have " + "\n\tdifferent object references."); } Console.WriteLine ("Does a comparison of copy of first permission to itself test equal??: " + (copyOfFirst.Equals(copyOfFirst)? "true": "false")); if (false == copyOfFirst.Equals(copyOfFirst)) { Console.WriteLine ("Copy_Equals demo failed because Equals returns false on two object.Equals(itself)."); } Console.WriteLine ("Does a comparison of first permission to itself test equal?: " + (first.Equals(first)? "true": "false")); if (false == first.Equals(first)) { Console.WriteLine ("Copy_Equals demo failed, because Equals returns false on two object.Equals(itself)."); } Console.WriteLine("Creating a second permission with PermissionState.None."); IsolatedStorageFilePermission second = new IsolatedStorageFilePermission(PermissionState.None); Console.WriteLine ("Does the first permission equal the second permission?: " + (first.Equals(second)? "true": "false")); if (true == first.Equals(second)) { Console.WriteLine ("Copy_Equals demo failed because Equals returns false on two object.Equals(itself)."); } }
void Copy_EqualsDemo() { Console::WriteLine( "\nCopy_Equals demo." ); Console::WriteLine( "Creating the first IsolatedStorageFilePermission(PermissionState.Unrestricted) permission." ); IsolatedStorageFilePermission^ first = gcnew IsolatedStorageFilePermission( PermissionState::Unrestricted ); Console::WriteLine( "Hashcode for the first permission : {0}", first->GetHashCode() ); Console::WriteLine( "Copying the first permission." ); IsolatedStorageFilePermission^ copyOfFirst = dynamic_cast<IsolatedStorageFilePermission^>(first->Copy()); Console::WriteLine( "Hashcode for copy of the first permission: {0}", copyOfFirst->GetHashCode() ); if ( false == copyOfFirst->Equals( first ) ) { Console::WriteLine( "The copy and the first permission should not be equal because they have " "\n\tdifferent object references." ); } else { Console::WriteLine( "Error: the copy and the first permission should not be equal because they have " "\n\tdifferent object references." ); } Console::WriteLine( "Does a comparison of copy of first permission to itself test equal??: {0}", (copyOfFirst->Equals( copyOfFirst ) ? (String^)"true" : "false") ); if ( false == copyOfFirst->Equals( copyOfFirst ) ) { Console::WriteLine( "Copy_Equals demo failed because Equals returns false on two object.Equals(itself)." ); } Console::WriteLine( "Does a comparison of first permission to itself test equal?: {0}", (first->Equals( first ) ? (String^)"true" : "false") ); if ( false == first->Equals( first ) ) { Console::WriteLine( "Copy_Equals demo failed, because Equals returns false on two object.Equals(itself)." ); } Console::WriteLine( "Creating a second permission with PermissionState.None." ); IsolatedStorageFilePermission^ second = gcnew IsolatedStorageFilePermission( PermissionState::None ); Console::WriteLine( "Does the first permission equal the second permission?: {0}", (first->Equals( second ) ? (String^)"true" : "false") ); if ( true == first->Equals( second ) ) { Console::WriteLine( "Copy_Equals demo failed because Equals returns false on two object.Equals(itself)." ); } }
private void Copy_EqualsDemo() { Console.WriteLine("\nCopy_Equals demo."); Console.WriteLine("Creating the first " + "IsolatedStorageFilePermission(PermissionState." + "Unrestricted) permission."); IsolatedStorageFilePermission first = new IsolatedStorageFilePermission(PermissionState.Unrestricted); Console.WriteLine(("Hashcode for the first permission : " + System.Convert.ToString(first.GetHashCode()))); Console.WriteLine("Copying the first permission."); IsolatedStorageFilePermission copyOfFirst = ((IsolatedStorageFilePermission)(first.Copy())); Console.WriteLine(("Hashcode for copy of the first permission: " + System.Convert.ToString(copyOfFirst.GetHashCode()))); if (false == copyOfFirst.Equals(first)) { // This should be false, because the object references are // different. Console.WriteLine(("The copy and the first permission " + "should not be equal because they have " + "\n\tdifferent object references.")); } else { Console.WriteLine(("Error: the copy and the first " + "permission should not be equal because they have " + "\n\tdifferent object references.")); } Console.WriteLine("Does a comparison of copy of first " + "permission to itself test equal??: " + ((copyOfFirst.Equals(copyOfFirst)) ? "true" : "false")); if (false == copyOfFirst.Equals(copyOfFirst)) { Console.WriteLine("Copy_Equals demo failed because Equals " + "returns false on two object.Equals(itself)."); } Console.WriteLine(("Does a comparison of first permission to " + "itself test equal?: " + ((first.Equals(first)) ? "true" : "false"))); if (false == first.Equals(first)) { Console.WriteLine("Copy_Equals demo failed, because Equals " + "returns false on two object.Equals(itself)."); } Console.WriteLine("Creating a second permission with " + "PermissionState.None."); IsolatedStorageFilePermission second = new IsolatedStorageFilePermission(PermissionState.None); Console.WriteLine(("Does the first permission equal the " + "second permission?: " + ((first.Equals(second)) ? "true" : "false"))); if (true == first.Equals(second)) { Console.WriteLine("Copy_Equals demo failed because Equals " + "returns false on two object.Equals(itself)."); } } //Copy_EqualsDemo

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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からIsolatedStorageFilePermission.Copy メソッドを検索する場合は、下記のリンクをクリックしてください。

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