+2009-11-30 Sebastien Pouliot <sebastien@ximian.com>
+
+ * CookieCollection.cs: Seal inner CookieCollectionPathComparer
+ * IPAddress.cs: Avoid multiple casts in Equals
+ * SocketAddress.cs: Avoid multiple casts in Equals
+ [Found using Gendarme]
+
2009-10-23 Alexandre Gomes <alexmipego@gmail.com>
* WebClient.cs: Fixed GetWebRequest overriding problems, bug:
#else
public class CookieCollection : ICollection, IEnumerable {
#endif
- class CookieCollectionPathComparer : IComparer
+ sealed class CookieCollectionPathComparer : IComparer
{
int IComparer.Compare (object p1, object p2)
{
/// </returns>
public override bool Equals (object other)
{
- if (other is System.Net.IPAddress){
- IPAddress otherAddr = other as IPAddress;
-
+ IPAddress otherAddr = other as IPAddress;
+ if (otherAddr != null){
if(AddressFamily != otherAddr.AddressFamily)
return false;
public override bool Equals (object obj)
{
- if (obj is System.Net.SocketAddress &&
- ((System.Net.SocketAddress) obj).data.Length == data.Length){
- byte [] otherData = ((System.Net.SocketAddress) obj).data;
+ SocketAddress sa = (obj as SocketAddress);
+ if ((sa != null) && (sa.data.Length == data.Length)) {
+ byte [] otherData = sa.data;
for (int i = 0; i < data.Length; i++)
if (otherData [i] != data [i])
return false;