Dmitry,
The switch/case statement in C# is definitely way more limiting than in VFP. You can't do what you're trying to do with a switch/case, you'd need to use if statements. The only part of the switch/case that you've used that is actually valid is just this:
switch (iTime)
{
case iBegin :
Response.Write("iTime = iBegin");
break;
case iEnd:
Response.Write("iTime = iEnd");
break;
}
You can only test that the variable is equal to what you specify in the case, that's it.
~~Bonnie
>I am probably misunderstanding something about use of switch statement. My understanding was that switch should function just like do case in VFP. Yet I find switch quite limitted, unless I misunderstand something.
>
>Here is a simple example of switch that does not work:
>
>int iTime = 5;
>int iBegin = 5;
>int iEnd = 7;
>
>switch (iTime)
> {
> case iTime == iBegin:
> Response.Write("iTime = iBegin");
> break;
> case iTime > iBegin && iTime < iEnd:
> Response.Write("iTime > iBegin and < iEnd");
> break;
> case iTime == iEnd:
> Response.Write("iTime = iEnd");
> break;
> }
>
>Yet, in VFP you can use DO CASE to compare the three values in a manner shown in the example above.
>
>What am I missing?