DataProtectionPermission.Copy Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Creates and returns an identical copy of the current permission.
public:
override System::Security::IPermission ^ Copy();
public override System.Security.IPermission Copy ();
override this.Copy : unit -> System.Security.IPermission
Public Overrides Function Copy () As IPermission
Returns
A copy of the current permission.
Examples
The following code example shows the use of the Copy method. This code example is part of a larger example provided for the DataProtectionPermission class.
Note
The code example is intended to show the behavior of the method, not to demonstrate its use. In general, the methods of permission classes are used by the security infrastructure; they are not typically used in applications.
Console::WriteLine( "Copying the second permission to the fourth "
"permission." );
sp4 = dynamic_cast<DataProtectionPermission^>(sp2->Copy());
rc = sp4->Equals( sp2 );
Console::WriteLine( "Is the fourth permission equal to the second "
"permission? {0}", (rc ? (String^)"Yes" : "No") );
Console.WriteLine("Copying the second permission to the fourth " +
"permission.");
sp4 = (DataProtectionPermission)sp2.Copy();
rc = sp4.Equals(sp2);
Console.WriteLine("Is the fourth permission equal to the second " +
"permission? " + (rc ? "Yes" : "No"));
Console.WriteLine("Copying the second permission to the fourth " + "permission.")
sp4 = CType(sp2.Copy(), DataProtectionPermission)
rc = sp4.Equals(sp2)
Console.WriteLine("Is the fourth permission equal to the second " + "permission? " + IIf(rc, "Yes", "No")) 'TODO: For performance reasons this should be changed to nested IF statements
Remarks
A copy of the permission represents the same access to resources as the original permission.
Applies to
משוב
https://aka.ms/ContentUserFeedback.
בקרוב: במהלך 2024, נפתור בעיות GitHub כמנגנון המשוב לתוכן ונחליף אותו במערכת משוב חדשה. לקבלת מידע נוסף, ראה:שלח והצג משוב עבור