NetworkInformationPermission.AddPermission Method

Adds the specified value to this permission.

Namespace:  System.Net.NetworkInformation
Assembly:  System (in System.dll)

public void AddPermission(
	NetworkInformationAccess access
)

Use this method to modify access to network information by adding to the state of the current permission.

The following example creates an empty permission object and then adds to it.

System.Net.NetworkInformation.NetworkInformationPermission permission = 
    new System.Net.NetworkInformation.NetworkInformationPermission(
        System.Security.Permissions.PermissionState.None);
permission.AddPermission(
        System.Net.NetworkInformation.NetworkInformationAccess.Read);
Console.WriteLine("Access is {0}", permission.Access);

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2015 Microsoft