SmtpPermission.Intersect(IPermission) 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 a permission that is the intersection of the current permission and the specified permission.
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
Parameters
- target
- IPermission
An IPermission to intersect with the current permission. It must be of the same type as the current permission.
Returns
An SmtpPermission that represents the intersection of the current permission and the specified permission. Returns null
if the intersection is empty or target
is null
.
Exceptions
target
is not an SmtpPermission.
Examples
The following code example creates a permission object that is the intersection of an existing permission with an object that grants full access to SMTP servers.
static SmtpPermission^ IntersectionWithFull(
SmtpPermission^ permission)
{
SmtpPermission^ allAccess =
gcnew SmtpPermission(PermissionState::Unrestricted);
return (SmtpPermission^) permission->Intersect(allAccess);
}
public static SmtpPermission IntersectionWithFull(SmtpPermission permission)
{
SmtpPermission allAccess = new
SmtpPermission(System.Security.Permissions.PermissionState.Unrestricted);
return (SmtpPermission) permission.Intersect(allAccess);
}
Remarks
The intersection of two permissions is a permission that describes the state they describe in common. Only a demand that passes both original permissions will pass the intersection.
Applies to
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應