Wayne M J <no*@home.nor.bigpuddle.com> wrote:
"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om... Why would you expect it not to work? You don't actually need the cast
in the first one - you can just do:
ep = iep;
because EndPoint is the base class of IPEndPoint.
When I did the ep = iep; it complained about an implicit cast.
That was when I originally wrote the code under VS.Net2002.
What exactly do you mean by "complained"? What did it say, exactly?
Could you reproduce it?
Don't forget that the variables ep and iep just hold references to
objects. Casting the reference doesn't change the type of the object at
all.
Actually I just reread the dox and this is the where I am sure I got the
idea from:
ms-help://MS.MSDNQTR.2003FEB.1033/cpref/html/frlrfSystemNetSocketsSocketClas
sReceiveFromTopic.htm
The cast in that code is unnecessary too. For instance:
using System;
using System.Net;
public class Test
{
static void Main()
{
IPEndPoint sender = new IPEndPoint(IPAddress.Any, 0);
EndPoint senderRemote = sender;
}
}
compiles with no problems.
--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too