TryParse() public static method

public static TryParse ( string addressWithPort, IPEndPoint &endpoint ) : bool
addressWithPort string
endpoint System.Net.IPEndPoint
return bool
コード例 #1
0
        public void ShouldNotParse(string input)
        {
            IPEndPoint endpoint;
            var        success = IPEndPointParser.TryParse(input, out endpoint);

            Assert.False(success);
            Assert.Null(endpoint);
        }
コード例 #2
0
        public void ParsesCorrectly(string input, string expectedAddress, int expectedPort)
        {
            IPEndPoint endpoint;
            var        success = IPEndPointParser.TryParse(input, out endpoint);

            Assert.True(success);
            Assert.Equal(expectedAddress, endpoint.Address.ToString());
            Assert.Equal(expectedPort, endpoint.Port);
        }