Author: alanmc
Date: 2007-05-23 20:42:43 -0400 (Wed, 23 May 2007)
New Revision: 77880
Modified:
trunk/Mono.Nat/Mapping.cs
Log:
Mapping is now a class.
Modified: trunk/Mono.Nat/Mapping.cs
===================================================================
--- trunk/Mono.Nat/Mapping.cs 2007-05-24 00:16:42 UTC (rev 77879)
+++ trunk/Mono.Nat/Mapping.cs 2007-05-24 00:42:43 UTC (rev 77880)
@@ -30,35 +30,49 @@
namespace Nat
{
- public struct Mapping
+ public class Mapping
{
+ #region Private Fields
+
+ private int port;
+ private Protocol protocol;
+
+ #endregion Private Fields
+
+
+ #region Properties
+
public int Port
{
get { return this.port; }
}
- private int port;
-
public Protocol Protocol
{
get { return this.protocol; }
}
- private Protocol protocol;
+ #endregion Properties
+
+ #region Constructors
+
public Mapping(int port, Protocol protocol)
{
this.port = port;
this.protocol = protocol;
}
-
+
+ #endregion Constructors
+
+
+ #region Methods
+
public override bool Equals(object obj)
{
- if (!(obj is Mapping))
- return false;
-
- Mapping instance = (Mapping)obj;
- return this.port == instance.port && this.protocol ==
instance.protocol;
+ Mapping other = obj as Mapping;
+ return other == null ? false : this.port == other.port
+ && this.protocol == other.protocol;
}
public override int GetHashCode()
@@ -66,14 +80,6 @@
return this.port.GetHashCode() ^ this.protocol.GetHashCode();
}
- public static bool operator ==(Mapping instanceA, Mapping instanceB)
- {
- return instanceA.Equals(instanceB);
- }
-
- public static bool operator !=(Mapping instanceA, Mapping instanceB)
- {
- return !instanceA.Equals(instanceB);
- }
+ #endregion Methods
}
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches