csharp 决策声明(如果,转换)

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了csharp 决策声明(如果,转换)相关的知识,希望对你有一定的参考价值。

Private Submit_click(s,e)
{
  int day = (int)day_textbox.text;
  
  switch (day)
    {
    case 0 :
    dayName = "Sunday";
    break;
    case 1 :
    dayName = "Monday";
    break;
    case 2 :
    dayName = "Tuesday";
    break;
    ...
    default :
    dayName = "Unknown";
    break;
    }
    
    dispayDay_textbox.Text = dayName;
}

//example 2

switch (current)
            {
                case '<':
                    target.Text += "&lt;";
                    break;
                case '>':
                    target.Text += "&gt;";
                    break;
                case '&':
                    target.Text += "&amp;";
                    break;
                case '\"':
                    target.Text += "&#34;";
                    break;
                case '\'':
                    target.Text += "&#39;";
                    break;
                default:
                    target.Text += current;
                    break;
            }
  
int result;
if (leftHandSide.Year < rightHandSide.Year)
  {
    result = -1;
  }
else if (leftHandSide.Year > rightHandSide.Year)
  {
    result = 1;
  }
else
  {
    result = 2;
  }

以上是关于csharp 决策声明(如果,转换)的主要内容,如果未能解决你的问题,请参考以下文章

来自多种数据类型特征的决策树

R语言 决策

csharp 切换声明

csharp 切换声明

csharp 声明Lambdas

csharp 在AccountController中获取声明