DataProtectionPermission.Intersect(IPermission) Metoda

Definicja

Tworzy i zwraca uprawnienie, które jest skrzyżowaniem bieżącego uprawnienia i określonego uprawnienia.

public:
 override System::Security::IPermission ^ Intersect(System::Security::IPermission ^ target);
public override System.Security.IPermission Intersect (System.Security.IPermission target);
override this.Intersect : System.Security.IPermission -> System.Security.IPermission
Public Overrides Function Intersect (target As IPermission) As IPermission

Parametry

target
IPermission

Uprawnienie do przecinania z bieżącym uprawnieniem. Musi to być ten sam typ co bieżące uprawnienie.

Zwraca

IPermission

Nowe uprawnienie, które reprezentuje przecięcie bieżącego uprawnienia i określonego uprawnienia. To nowe uprawnienie jest null takie, jeśli skrzyżowanie jest puste.

Wyjątki

target nie null jest i nie określa uprawnienia tego samego typu co bieżące uprawnienie.

Przykłady

Poniższy przykład kodu przedstawia użycie Intersect metody . Ten przykład kodu jest częścią większego przykładu podanego DataProtectionPermission dla klasy.

Console::WriteLine( "Creating the intersection of the second and "
"first permissions." );
sp4 = dynamic_cast<DataProtectionPermission^>(sp2->Intersect( sp1 ));
Console::WriteLine( "The value of the Flags property is: {0}", sp4->Flags );
Console.WriteLine("Creating the intersection of the second and " +
    "first permissions.");
sp4 = (DataProtectionPermission)sp2.Intersect(sp1);
Console.WriteLine("The value of the Flags property is: " +
    sp4.Flags.ToString());
Console.WriteLine("Creating the intersection of the second and " + "first permissions.")
sp4 = CType(sp2.Intersect(sp1), DataProtectionPermission)
Console.WriteLine("The value of the Flags property is: " + sp4.Flags.ToString())

Uwagi

Przecięcie dwóch uprawnień to uprawnienie opisujące wspólny zestaw operacji opisanych w obu tych operacjach. Tylko zapotrzebowanie, które przechodzi obie poszczególne uprawnienia, przejdzie przez skrzyżowanie.

Dotyczy