C# doesn't support ranges in switch statements. You'll have to use
if/then. 


Eric

-----Original Message-----
From: Stephen Russell [mailto:[EMAIL PROTECTED]
Sent: Tuesday, December 28, 2004 10:15 AM
To: [EMAIL PROTECTED]
Subject: [C#.NET] Switch and can't convert


This is my error message in the complie?
" Cannot implicitly convert type 'bool' to 'int'"

I have retarted Tax rules that are value based.  So I'm trying to do
this:

public double FigureLocal(double dPrice) { int  low = 1600, mid = 3200;
int lnPrice = System.Convert.ToInt16(dPrice); switch (lnPrice) {
      case (lnPrice < low) :   <<<<<<<<<  errors here and all other
case
statement/lines
      {
      lnLocal = lnPrice * .0225;
      break;
      }
      case lnPrice <= mid:
      {
      lnLocal = ((lnPrice - 1600) * .0275) + (1600 * .0225);
      break;
      }
      case lnPrice >= mid:
      {
      lnLocal = (1600 * .0275) + (1600 * .0225);
      break;
      }
}

return lnLocal;
}

Stephen Russell
S.R. & Associates
Memphis, TN 38115

901.246-0159



------------------------ Yahoo! Groups Sponsor --------------------~-->
$4.98 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/Q7_YsB/neXJAA/yQLSAA/XGgtlB/TM
--------------------------------------------------------------------~->


Yahoo! Groups Links








Yahoo! Groups Sponsor
ADVERTISEMENT
click here


Yahoo! Groups Links

Reply via email to