Creates and returns a new instance of the System.Net.SocketPermission class.
An instance of the System.Net.SocketPermission class that corresponds to the security declaration.
Type Reason ArgumentException One or more of the current instance's SocketPermissionAttribute.Access, SocketPermissionAttribute.Host, SocketPermissionAttribute.Transport or SocketPermissionAttribute.Port properties is null.
The SocketPermissionAttribute.CreatePermission method is called by the security system, not by the application code. The security information described by System.Net.SocketPermissionAttribute is stored in the metadata of the attribute target, which is the class to which the System.Net.SocketPermissionAttribute is applied. The system then accesses the information at run-time and calls SocketPermissionAttribute.CreatePermission. The system uses the returned System.Security.IPermission to enforce the specified security requirements.