System.Net.DnsEndPoint.ToString C# (CSharp) Метод

ToString() публичный Метод

public ToString ( ) : string
Результат string
        public override string ToString()
        {
            return _family + "/" + _host + ":" + _port;
        }

Usage Example

Пример #1
0
		public void Constructor_StringInt ()
		{
			Assert.Throws<ArgumentNullException> (delegate {
				new DnsEndPoint (null, 0);
			}, "ctor(null,0)");
			Assert.Throws<ArgumentException> (delegate {
				new DnsEndPoint (String.Empty, 0);
			}, "ctor(Empty,0)");
			Assert.Throws<ArgumentOutOfRangeException> (delegate {
				new DnsEndPoint ("localhost", -1);
			}, "ctor(localhost,-1)");
			Assert.Throws<ArgumentOutOfRangeException> (delegate {
				new DnsEndPoint ("localhost", (0xffff + 1));
			}, "ctor(localhost,(0xffff + 1))");

			DnsEndPoint dep = new DnsEndPoint ("localhost", 65535);
			Assert.AreEqual (AddressFamily.Unspecified, dep.AddressFamily, "AddressFamily");
			Assert.AreEqual ("localhost", dep.Host, "Host");
			Assert.AreEqual (65535, dep.Port, "Port");
			Assert.IsFalse (dep.Equals (null), "Equals(null)");
			Assert.IsTrue (dep.Equals (dep), "Equals(self)");
			Assert.AreEqual ("Unspecified/localhost:65535", dep.ToString ());
		}
All Usage Examples Of System.Net.DnsEndPoint::ToString