//我相信LZ更不愿意这样写:
string constellation;
switch(month_day)
{
case:"0321":
case:"0322":
...
case:"0420":constellation="白羊";break;
case:"0421":
case:"0422":
...
case:"0521":constellation="金牛";break;
...
}
//有必要一定要用switch吗?
string constellation;
switch(month_day)
{
case:"0321":
case:"0322":
...
case:"0420":constellation="白羊";break;
case:"0421":
case:"0422":
...
case:"0521":constellation="金牛";break;
...
}
//有必要一定要用switch吗?
解决方案 »
- 要一个正则表达式。
- 将数据写入xml文档的问题~!!!
- Microsoft”中不存在类型或命名空间名称“Office”
- c#怎么通过代码启动QQ
- xslt 怎么对 XML 数据 分页
- codeporject的速度很慢怎么处理?
- 基于进程的流量监控
- ***如何用正则表达式把<IMG height=43 src="/IRS/images/baixue.gif" width=148 border=0>中images/baixue.gif提出?***
- 小弟用C#写了个系统进程管理系统。代码我现在发到网上了。需要的可以下。
- 求助!Geckowebbrowser控件中显示的网页怎么调用C#中的函数?
- TCP会出现这样的交错粘包吗?
- C# TCP消息边界问题
//我相信LZ更不愿意这样写:
string constellation;
switch(month_day)
{
case "0321":
case "0322":
...
case "0420":constellation="白羊";break;
case "0421":
case "0422":
...
case "0521":constellation="金牛";break;
...
}
//有必要一定要用switch吗?
if(x>321&& x<420)
{
.....
}
else if(...)
{
.....
}
......
int monthDay = int.Parse("0609");
int month = month / 100;
int day = month % 100;
switch (month)
{
case 3: result = (day < 21) ? enumHoroscope.Pisces : enumHoroscope.Aries; break;
}
int monthDay = int.Parse("0609"); // try+catch
int month = monthDay / 100; // 1~12?
int day = monthDay % 100; // 1~31? Feb 30? Apr 31?
switch (month)
{
case 3: result = (day < 21) ? enumHoroscope.Pisces : enumHoroscope.Aries; break;
}