ufcpp-live / UfcppLiveAgenda

@ufcpp live streaming agenda
MIT License
24 stars 2 forks source link

C# 10.0 / .NET 6.0 / Visual Studio 2022 正式リリース記念 #49

Closed ufcpp closed 2 years ago

ufcpp commented 2 years ago

配信URL: https://youtu.be/-5jmoMUCQnc

前回最後に話した通り

PST 8日8時半 (日本時間9日)にリリースされてるはずなので、9日の夜に配信しようかと。 Visual Studio 2022 のローンチ イベント は終わってて、.NET Conf は開催直前なタイミング。

雑談の肴に、C# 10.0 機能一覧: https://github.com/ufcpp/UfcppSample/issues/342

ufcpp commented 2 years ago

「やっちまいな」リスト:

あと、「VS 2022 が csproj を xml 扱いしてタブになる件」の回避策:

ufcpp commented 2 years ago

一応、今日出たっぽいブログ

https://devblogs.microsoft.com/dotnet/announcing-net-6/ https://devblogs.microsoft.com/dotnet/welcome-to-csharp-10/

C# 10 ののを見た初見の印象: sealed modifier on ToString() in record classes とかちゃんとブログに書くんだw 誰得w async method builder override はそれ以下なんだw

ufcpp commented 2 years ago

いくつかのプロジェクトを Convert to file-scoped namespace を solution 全体に対して機械的にかけた結果、

だった。

ufcpp-live commented 2 years ago

image

ufcpp-live commented 2 years ago

17.1 以降限定

image

ufcpp-live commented 2 years ago

いつまでベータ?

image

ufcpp-live commented 2 years ago

みんなー、global using で自前 LINQ の地雷は踏んだー??

namespace X;

// EnumerableEx にも MaxBy がいたとして、
// 拡張メソッドの解決、内側優先なので、内側に using を書けば OK。
using static ConsoleApp1.EnumerableEx;

class Program
{
    public void M()
    {
        var x = new[] { 1, 2, 3, 4, 5 }.MaxBy(x => x);
    }
}
ufcpp-live commented 2 years ago

image

ufcpp-live commented 2 years ago

アンケート事案:

これ、生理的に受け付ける?

namespace ConsoleApp1;

public class Class1
{
}
ufcpp-live commented 2 years ago

image

ufcpp-live commented 2 years ago

うちで「net6.0 にしただけで単体テストがこけた」の1つ:

var m = new MemoryStream();
var w = new StreamWriter(m);
w.Write("aqswdefrgtyhujik");

var data = m.ToArray();

// 実際にはここに CryptoStream 挟んでる
var r = new MemoryStream(data);

var buffer = new byte[data.Length];
r.Read(buffer);

// buffer の後ろの方が0のまま残ってた。
Assert.Equal(data, buffer);

// 修正結果

int totalRead = 0;
while (true)
{
    var read = r.Read(buffer.AsSpan(totalRead));
    if (read == 0) break;
    totalRead += read;
}
ufcpp-live commented 2 years ago

左、いいよ!

image