Creates a SocketPermission from the union of two SocketPermissions
Imports System.IO
Imports System.Net
Imports System.Text
Imports System.Security.Permissions
Imports System.Collections
Imports System.Collections.Generic
public class MainClass
Shared Sub Main()
Dim mySocketPermission1 As New SocketPermission(PermissionState.None)
mySocketPermission1.AddPermission(NetworkAccess.Accept, TransportType.Tcp, "www.domain.com", 11000)
Dim mySocketPermission2 As New SocketPermission(NetworkAccess.Connect, TransportType.Tcp, "www.southridgevideo.com", 11002)
Dim mySocketPermissionUnion As SocketPermission = CType(mySocketPermission1.Union(mySocketPermission2), SocketPermission)
If mySocketPermission1.IsSubsetOf(mySocketPermissionUnion) And mySocketPermission2.IsSubsetOf(mySocketPermissionUnion) Then
Dim myEnumerator As IEnumerator = mySocketPermissionUnion.AcceptList
While myEnumerator.MoveNext()
Console.WriteLine(CType(myEnumerator.Current, EndpointPermission).ToString())
End While
myEnumerator = mySocketPermissionUnion.ConnectList
While myEnumerator.MoveNext()
Console.WriteLine(CType(myEnumerator.Current, EndpointPermission).ToString())
End While
End If
End Sub
End Class
Related examples in the same category