[Mono-list] IPAddress code review
Nick Drochak
nick@jobdragon.com
Wed, 21 Nov 2001 16:33:51 +0900
This is a multi-part message in MIME format.
------=_NextPart_000_0037_01C172AA.4D6B02B0
Content-Type: text/plain;
charset="utf-8"
Content-Transfer-Encoding: quoted-printable
Miguel,
A few comments about IPAddress, which doesn't compile:
1) In the IPAddress constructor you're trying to assign an IPAddress =
type to the address member which is unit type.
2) It's supposed to be 'Address' not 'address' anyway :)
3) You've used double slash (//) instead of triple slash (///) for the =
comments.
I've attached a diff which corrects these, if they do actually need =
fixin'.
Best,
Nick D.
------=_NextPart_000_0037_01C172AA.4D6B02B0
Content-Type: application/octet-stream;
name="IPAddress.diff"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
filename="IPAddress.diff"
? IPAddress.diff=0A=
Index: IPAddress.cs=0A=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A=
RCS file: /cvs/public/mcs/class/System/System.Net/IPAddress.cs,v=0A=
retrieving revision 1.2=0A=
diff -u -r1.2 IPAddress.cs=0A=
--- IPAddress.cs 2001/11/20 15:47:49 1.2=0A=
+++ IPAddress.cs 2001/11/21 03:29:56=0A=
@@ -9,11 +9,11 @@=0A=
=0A=
namespace System.Net {=0A=
=0A=
- // <remarks>=0A=
- // Encapsulates an IP Address.=0A=
- // </remarks>=0A=
+ /// <remarks>=0A=
+ /// Encapsulates an IP Address.=0A=
+ /// </remarks>=0A=
public class IPAddress {=0A=
- public uint address;=0A=
+ public uint Address;=0A=
=0A=
public static readonly IPAddress Any;=0A=
public static readonly IPAddress Broadcast;=0A=
@@ -27,23 +27,23 @@=0A=
=0A=
static IPAddress ()=0A=
{=0A=
- Any.address =3D new IPAddress (InaddrAny);=0A=
- Broadcast.address =3D new IPAddress (InaddrBroadcast);=0A=
- Loopback.address =3D new IPAddress (InaddrLoopback);=0A=
- None.address =3D new IPAddress (InaddrNone);=0A=
+ Any.Address =3D InaddrAny;=0A=
+ Broadcast.Address =3D InaddrBroadcast;=0A=
+ Loopback.Address =3D InaddrLoopback;=0A=
+ None.Address =3D InaddrNone;=0A=
}=0A=
=0A=
- // <summary>=0A=
- // Constructor from a 32-bit constant.=0A=
- // </summary>=0A=
+ /// <summary>=0A=
+ /// Constructor from a 32-bit constant.=0A=
+ /// </summary>=0A=
public IPAddress (uint address)=0A=
{=0A=
- this.address =3D address;=0A=
+ this.Address =3D address;=0A=
}=0A=
=0A=
- // <summary>=0A=
- // Constructor from a dotted quad notation. =0A=
- // </summary>=0A=
+ /// <summary>=0A=
+ /// Constructor from a dotted quad notation. =0A=
+ /// </summary>=0A=
public IPAddress (string ip)=0A=
{=0A=
string[] ips =3D ip.Split (new char[] {'.'});=0A=
@@ -53,31 +53,31 @@=0A=
for (i =3D 0; i < ips.Length; i++)=0A=
a =3D (a << 8) | (UInt16.Parse(ips [i]));=0A=
=0A=
- address =3D a;=0A=
+ Address =3D a;=0A=
}=0A=
=0A=
- // <summary>=0A=
- // Used to tell whether an address is a loopback.=0A=
- // </summary>=0A=
- // <param name=3D"addr">Address to compare</param>=0A=
- // <returns></returns>=0A=
+ /// <summary>=0A=
+ /// Used to tell whether an address is a loopback.=0A=
+ /// </summary>=0A=
+ /// <param name=3D"addr">Address to compare</param>=0A=
+ /// <returns></returns>=0A=
public static bool IsLoopback (IPAddress addr)=0A=
{=0A=
- return addr.address =3D=3D InaddrLoopback;=0A=
+ return addr.Address =3D=3D InaddrLoopback;=0A=
}=0A=
=0A=
- // <summary>=0A=
- // Overrides System.Object.ToString to return=0A=
- // this object rendered in a quad-dotted notation=0A=
- // </summary>=0A=
+ /// <summary>=0A=
+ /// Overrides System.Object.ToString to return=0A=
+ /// this object rendered in a quad-dotted notation=0A=
+ /// </summary>=0A=
public override string ToString ()=0A=
{=0A=
- return ToString (address);=0A=
+ return ToString (Address);=0A=
}=0A=
=0A=
- // <summary>=0A=
- // Returns this object rendered in a quad-dotted notation=0A=
- // </summary>=0A=
+ /// <summary>=0A=
+ /// Returns this object rendered in a quad-dotted notation=0A=
+ /// </summary>=0A=
public static string ToString (uint addr)=0A=
{=0A=
return (addr >> 24).ToString () + "." +=0A=
@@ -86,20 +86,20 @@=0A=
(addr & 0xff).ToString ();=0A=
}=0A=
=0A=
- // <returns>=0A=
- // Whether both objects are equal.=0A=
- // </returns>=0A=
+ /// <returns>=0A=
+ /// Whether both objects are equal.=0A=
+ /// </returns>=0A=
public override bool Equals (object other)=0A=
{=0A=
if (other is System.Net.IPAddress){=0A=
- return address =3D=3D ((System.Net.IPAddress) other).address;=0A=
+ return Address =3D=3D ((System.Net.IPAddress) other).Address;=0A=
}=0A=
return false;=0A=
}=0A=
=0A=
public override int GetHashCode ()=0A=
{=0A=
- return (int)address;=0A=
+ return (int)Address;=0A=
}=0A=
}=0A=
=0A=
------=_NextPart_000_0037_01C172AA.4D6B02B0--