Commit f7a4110e authored by Nick Craver's avatar Nick Craver

Cleanup: EndPointCollection

parent 6c44a771
...@@ -13,35 +13,30 @@ public sealed class EndPointCollection : Collection<EndPoint> ...@@ -13,35 +13,30 @@ public sealed class EndPointCollection : Collection<EndPoint>
/// <summary> /// <summary>
/// Create a new EndPointCollection /// Create a new EndPointCollection
/// </summary> /// </summary>
public EndPointCollection() : base() public EndPointCollection() {}
{
}
/// <summary> /// <summary>
/// Create a new EndPointCollection /// Create a new EndPointCollection
/// </summary> /// </summary>
public EndPointCollection(IList<EndPoint> endpoints) : base(endpoints) /// <param name="endpoints">The endpoints to add to the collection.</param>
{ public EndPointCollection(IList<EndPoint> endpoints) : base(endpoints) {}
}
/// <summary> /// <summary>
/// Format an endpoint /// Format an endpoint
/// </summary> /// </summary>
public static string ToString(EndPoint endpoint) /// <param name="endpoint">The endpoint to get a string representation for.</param>
{ public static string ToString(EndPoint endpoint) => Format.ToString(endpoint);
return Format.ToString(endpoint);
}
/// <summary> /// <summary>
/// Attempt to parse a string into an EndPoint /// Attempt to parse a string into an EndPoint
/// </summary> /// </summary>
public static EndPoint TryParse(string endpoint) /// <param name="endpoint">The endpoint string to parse.</param>
{ public static EndPoint TryParse(string endpoint) => Format.TryParseEndPoint(endpoint);
return Format.TryParseEndPoint(endpoint);
}
/// <summary> /// <summary>
/// Adds a new endpoint to the list /// Adds a new endpoint to the list
/// </summary> /// </summary>
/// <param name="hostAndPort">The host:port string to add an endpoint for to the collection.</param>
public void Add(string hostAndPort) public void Add(string hostAndPort)
{ {
var endpoint = Format.TryParseEndPoint(hostAndPort); var endpoint = Format.TryParseEndPoint(hostAndPort);
...@@ -50,24 +45,24 @@ public void Add(string hostAndPort) ...@@ -50,24 +45,24 @@ public void Add(string hostAndPort)
} }
/// <summary> /// <summary>
/// Adds a new endpoint to the list /// Adds a new endpoint to the list.
/// </summary> /// </summary>
public void Add(string host, int port) /// <param name="host">The host to add.</param>
{ /// <param name="port">The port for <paramref name="host"/> to add.</param>
Add(Format.ParseEndPoint(host, port)); public void Add(string host, int port) => Add(Format.ParseEndPoint(host, port));
}
/// <summary> /// <summary>
/// Adds a new endpoint to the list /// Adds a new endpoint to the list.
/// </summary> /// </summary>
public void Add(IPAddress host, int port) /// <param name="host">The host to add.</param>
{ /// <param name="port">The port for <paramref name="host"/> to add.</param>
Add(new IPEndPoint(host, port)); public void Add(IPAddress host, int port) => Add(new IPEndPoint(host, port));
}
/// <summary> /// <summary>
/// See Collection&lt;T&gt;.InsertItem() /// See Collection&lt;T&gt;.InsertItem()
/// </summary> /// </summary>
/// <param name="index">The index to add <paramref name="item"/> into the collection at.</param>
/// <param name="item">The item to insert at <paramref name="index"/>.</param>
protected override void InsertItem(int index, EndPoint item) protected override void InsertItem(int index, EndPoint item)
{ {
if (item == null) throw new ArgumentNullException(nameof(item)); if (item == null) throw new ArgumentNullException(nameof(item));
...@@ -77,6 +72,8 @@ protected override void InsertItem(int index, EndPoint item) ...@@ -77,6 +72,8 @@ protected override void InsertItem(int index, EndPoint item)
/// <summary> /// <summary>
/// See Collection&lt;T&gt;.SetItem() /// See Collection&lt;T&gt;.SetItem()
/// </summary> /// </summary>
/// <param name="index">The index to replace an endpoint at.</param>
/// <param name="item">The item to replace the existing endpoint at <paramref name="index"/>.</param>
protected override void SetItem(int index, EndPoint item) protected override void SetItem(int index, EndPoint item)
{ {
if (item == null) throw new ArgumentNullException(nameof(item)); if (item == null) throw new ArgumentNullException(nameof(item));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment