#region 1.out引數var str = "2"
;
///之前的寫法
}//c#7的寫法
//或者
if (int.tryparse(str, out
varvvalue))
}#endregion
#region 2.模式 pattern
//////具有模式的 is 表示式
/// private
void
printstars(object ovalue)
#region 3. swith#endregion
//////可以設定任何型別的 switch 語句(不只是原始型別)
///模式可以用在 case 語句中
///case 語句可以有特殊的條件
/// private
void swith(string
svalue)
}
#region 4.數字分隔符【每隔3位+"_"】long lvalue =100_000_000;
writeline(lvalue);
#endregion
#region 5. 區域性函式}#endregion
#region 6.元組#endregion
//// 需要安裝這個nuget包
/// ///
///private (string, string, string) lookupname(long id) //
tuple return type
private (string first, string middle, string last) lookupnamebyname(long id) //
tuple return type
C 6 的一些新語法
public class people public string name public int age c 6新語法.8.自動實現的屬性初始化器 public datetime birthday datetime.now.addyears 22 c 6新語法 在屬性 方法裡使用lambda表示式...
C 與C 的一些語法區別
這學期有c 的課,由於之前有c和c 的一些基礎,所以並沒有從頭開始學習其語法,在這裡總結一下實際使用中發現的c 與c 的一些區別,便於以後使用時進行查閱 其實是為了考期複習方便2333 c是完全面向過程的語言,用於開發規模較小的程式效率很高,但是程式較大,就顯得 量多,編寫效率下降了。c 是半面相物...
C和C 的一些語法區別
struct 在c語言中,試用定義的struct型別的變數方式 struct 定義的變數 生成的變數 在c 語言中,試用定義的struct型別的變數方式 struct 定義的變數 生成的變數 或者 定義的變數 生成的變數 在c語言中struct定義的變數中不能有函式,而在c 中可以有函式。函式的引數...