IPEndPoint.Serialize Methode

Definitie

Serialiseert eindpuntgegevens in een SocketAddress exemplaar.

public:
 override System::Net::SocketAddress ^ Serialize();
public override System.Net.SocketAddress Serialize();
override this.Serialize : unit -> System.Net.SocketAddress
Public Overrides Function Serialize () As SocketAddress

Retouren

Een SocketAddress exemplaar met het socketadres voor het eindpunt.

Voorbeelden

In het volgende voorbeeld wordt de Serialize methode gebruikt om eindpuntgegevens in een SocketAddress exemplaar te serialiseren.

// The serializeEndpoint method serializes the endpoint and returns the
// SocketAddress containing the serialized endpoint data.
private static SocketAddress serializeEndpoint(IPEndPoint endpoint)
{

  // Serialize IPEndPoint details to a SocketAddress instance.
  SocketAddress socketAddress = endpoint.Serialize();

  // Display the serialized endpoint information.
  Console.WriteLine("Endpoint.Serialize() : " + socketAddress.ToString());

  Console.WriteLine("Socket.Family : " + socketAddress.Family);
  Console.WriteLine("Socket.Size : " + socketAddress.Size);

  Console.WriteLine("Press any key to continue.");
  Console.ReadLine();

  return socketAddress;
}
' The serializeEndpoint method serializes the endpoint and returns the 
' SocketAddress containing the serialized endpoint data.
Private Shared Function serializeEndpoint(ByVal endpoint As IPEndPoint) As SocketAddress

  ' Serialize IPEndPoint details to a SocketAddress instance.
  Dim socketAddress As SocketAddress = endpoint.Serialize()

  ' Display the serialized endpoint information.
  Console.WriteLine("Endpoint Serialize() : " + socketAddress.ToString())

  Console.WriteLine("Socket Family : " + socketAddress.Family.ToString())
  Console.WriteLine("Socket Size : " + socketAddress.ToString())

  Console.WriteLine("Press any key to continue.")
  Console.ReadLine()

  Return socketAddress
End Function 'serializeEndpoint

Van toepassing op

Zie ook