Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.NET 8 正式リリース記念 #83

Open
ufcpp opened this issue Nov 15, 2023 · 2 comments
Open

.NET 8 正式リリース記念 #83

ufcpp opened this issue Nov 15, 2023 · 2 comments

Comments

@ufcpp
Copy link
Collaborator

ufcpp commented Nov 15, 2023

配信URL: https://www.youtube.com/watch?v=1w-E4QgmAdg

1年振り返る?

リリース関連ブログ等:

C# 12

今年、割かし「コレクション式とプライマリコンストラクターの2個」感ある。
プライマリコンストラクター相変わらず燃えがち。
小さい機能が今年全然なかったってのあるかも。

コレクション式とプライマリコンストラクターは Visual Studio のサジェスト出てる分くらいは書き換えてもいいかも。
会社で今触ってるコード、それぞれ1000件以上出てた。

C# 13?

\e (エスケープ文字のエスケープシーケンス)、もう入ってた。

.NET

  • IUtf8SpanFormattable, IUtf8SpanParsable
  • TimeProvider
  • Vector512
  • UnsafeAccessor
  • ConfigureAwaitOptions
  • SearchValues
  • FrozenDictionary

個人の感想等

  • FrozenDictionary 導入済み
  • TimeProvider 全面的に使いたいけども既存コードの DateTimeOffset.Now/UtcNow 直呼びしてるところ多すぎて泣きそう
  • IUtf8SpanFormattable, IUtf8SpanParsable だいぶありがたいけども自分で実装する人は少なそう
  • UnsafeAccessor 本来用途は AOT でリフレクションの代わりだけど、テストで internal visible to の代わりに使うのの方が熱そう
@ufcpp-live
Copy link
Owner

using System.Runtime.CompilerServices;

M(null!);

[UnsafeAccessor(UnsafeAccessorKind.StaticMethod, Name = "M")]
static extern void M(in Static _);

// static を付けると困る
class Static
{
    public static void M() { }
}

@ufcpp-live
Copy link
Owner

// 匿名レコードだと思うと X, Y はプロパティに類する。
// 大文字。
(int X, int Y) t;

// 多値戻り値だと思うと x, y は変数に類する。
// 小文字。
(int x, int y) m(int x, int y) => (x, y);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants