Re: Telnet: Grabbing Bytes Previously Written During Next Read?

Tech-Archive recommends: Fix windows errors by optimizing your registry



On Wed, 16 Jan 2008 12:25:27 -0800, pbd22 <dushkin@xxxxxxxxx> wrote:

Thanks Pete.

I feel a bit thick on this.

That's okay. I know how hard it can be to try to write code on a Monday.. :)

I am still struggling with ClientSate in the switch statement.

Left alone, I get

"ClientState is a type but is used like a variable".

That's because you (apparently) do not have a variable named "ClientState".

When I do something like

ClientSate state = new ClientState();

Variable name is "state", not "ClientState".

or

state = new ClientState();

See above.

and then

switch (ClientState)

the compiler still throws the error.

Sure, it would. If you've named your variable "state" instead of "ClientState", then the switch statement should read "switch (state)" instead of "switch (ClientState)".

Again, this isn't unique to enums...don't get hung up the fact that it's an enum. The point of using an enum is that they can be used like a regular simple value type. So the rules for writing code using enums are the same as if you were writing code using, for example, an int or a char or a long, etc.

I'm sorry if using the same name for the variable as the type has confused things. It's funny...I generally try _not_ to do that, but it's a common ..NET convention for naming properties and public fields. So when I had a data member of a data structure of type "ClientState" in my original example, I just reused the type name for the name of that data member. Things seem to have gone downhill from there. :)

Pete
.