switch ..case

int i=3; 
switch(i) 
{ 
    case 1: 
    Console.Write(1); 
    break; 

    case 2: 
    Console.Write(2); 
    break; 

    case 3: 
    Console.Write(3); 
    break; 

    default: 
    Console.Write("default"); 
    break; 
}

 三元表达式

 int i=3; int j=i<5?3:6; Console.Write(j); 

?? 运算符

如果此运算符的左操作数不为 null,则此运算符将返回左操作数;否则返回右操作数。

双问号操作符意思是取所赋值??左边的,如果左边为null,取所赋值??右边的,
比如int y = x ?? -1 如果x为空,那么y的值为-1.
 
String.Format
string p1 = "Jackie";
string p2 = "Aillo";
Response.Write(String.Format("Hello {0}, I'm {1}", p1, p2));
 

相关文章:

  • 2021-10-05
  • 2021-09-03
  • 2022-12-23
  • 2022-12-23
  • 2022-01-01
  • 2022-12-23
  • 2022-12-23
  • 2021-07-15
猜你喜欢
  • 2021-12-19
  • 2021-10-02
  • 2021-08-03
  • 2021-07-19
  • 2021-08-19
  • 2021-10-10
  • 2022-01-26
相关资源
相似解决方案