NetworkInformationPermission.AddPermission(NetworkInformationAccess) 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.
Adds the specified value to this permission.
public:
void AddPermission(System::Net::NetworkInformation::NetworkInformationAccess access);
public void AddPermission (System.Net.NetworkInformation.NetworkInformationAccess access);
member this.AddPermission : System.Net.NetworkInformation.NetworkInformationAccess -> unit
Public Sub AddPermission (access As NetworkInformationAccess)
Parameters
- access
- NetworkInformationAccess
One of the NetworkInformationAccess values.
Examples
The following example creates an empty permission object and then adds to it.
System::Net::NetworkInformation::NetworkInformationPermission^ permission = gcnew System::Net::NetworkInformation::NetworkInformationPermission( System::Security::Permissions::PermissionState::None );
permission->AddPermission( System::Net::NetworkInformation::NetworkInformationAccess::Read );
Console::WriteLine( L"Access is {0}", permission->Access );
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);
Dim permission As New System.Net.NetworkInformation.NetworkInformationPermission( _
System.Security.Permissions.PermissionState.None)
permission.AddPermission(System.Net.NetworkInformation.NetworkInformationAccess.Read)
Console.WriteLine("Access is {0}", permission.Access)
Remarks
Use this method to modify access to network information by adding to the state of the current permission.
Applies to
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.