SmtpPermission.Union Method

Note: This method is new in the .NET Framework version 2.0.

Creates a permission that is the union of the current permission and the specified permission.

Namespace: System.Net.Mail
Assembly: System (in system.dll)

public:
virtual IPermission^ Union (
	IPermission^ target
) override
public IPermission Union (
	IPermission target
)
public override function Union (
	target : IPermission
) : IPermission

Parameters

target

An IPermission to combine with the current permission.

Return Value

A new SmtpPermission permission that represents the union of the current permission and the specified permission.

Exception typeCondition

ArgumentException

target is not an SmtpPermission.

The Union method returns a permission that represents all the states represented by both the current permission and the specified permission. Any demand that passes either permission passes their union.

The following example creates a permission object that is the union of two permission objects.

static SmtpPermission^ UnionWithFull(
    SmtpPermission^ permission)
{
    SmtpPermission^ allAccess = 
        gcnew SmtpPermission(PermissionState::Unrestricted);
    return (SmtpPermission^) permission->Union(allAccess);
}

public static SmtpPermission UnionWithFull(SmtpPermission permission)
{
    SmtpPermission allAccess = new SmtpPermission(
        System.Security.Permissions.PermissionState.Unrestricted);
    return (SmtpPermission)(permission.Union(allAccess));
} //UnionWithFull

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

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0

Community Additions

ADD
Show: