SmtpPermission.Union Method

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
Not applicable.

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 Server 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 Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0

Community Additions

ADD
Show: