# [Build 2024] What's new in C# 13 YT: https://www.youtube.com/watch?v=O3hx6oPWzX8 PS: 預期 2024/11 的 .NET Conf 才會正式發表 C# 13 標準 ## New keyword ### `field` ![image](https://hackmd.io/_uploads/HJqVDwBN0.png) 只有在 auto property 裡面有意義,這樣可以更方便 auto property 的撰寫 ### `implicit/explicit extension {name} for {type}` C# 13 新的 keyword 來建立 extension method,或者說這算是一個 **extension type** 因為宣告就指定了什麼型態的 extension,所以本來 extension method 的第一個參數 `this string s` 可以忽略直接使用 `this` 就代表傳入的那個參數 ![image](https://hackmd.io/_uploads/HkgewvPBVR.png) 裡面的 static method 改變成為的意義就是變成 **type** 等級的,意思就是同圖,打 `string.` 就可以出現那個 method ![image](https://hackmd.io/_uploads/BkSwvvrVA.png) 所以順勢就可以做成 extension property 了 ![image](https://hackmd.io/_uploads/Hyyk9PH4R.png) 如果覺得 implicit 太廣就可以用上 `excplicit` 可以只用在某個型態囉!! 既然 extension property 可以,那 extension index property 也就沒有問題了! (範例是用 index property 取得 uint64 某個 bit 的值) ![image](https://hackmd.io/_uploads/BJjR3DSVR.png)