[Mono-list] C sharp syntax [OT?]

James Ots me@jamesots.com
01 May 2002 21:57:04 +0100


This is probably off topic, as it is a question about C sharp syntax...

The following code is okay:

IPAddress[] AddressList = host.AddressList;
IPEndPoint ipend = new IPEndPoint( AddressList[0], 23 );

while the following is not:

IPEndPoint ipend = new IPEndPoint( host.AddressList[0], 23 );

Why is this?

In IPHostEntry it appears the second format is used, but I get an error
message when I do it:

./Sock.cs(26) error CS0118: Expression denotes a `property access' where
a `variable' was expected
Error: Compilation failed

-- 
Cheers
James Ots