以下の内容はhttps://baba-s.hatenablog.com/entry/2019/09/03/230400より取得しました。


【C#】DateTime を代入する時の記述を簡略化する Deconstruction

ソースコード

using System;

public static class DateTimeExt
{
    public static void Deconstruct
    (
        this DateTime self,
        out  int      year,
        out  int      month,
        out  int      day
    )
    {
        year  = self.Year;
        month = self.Month;
        day   = self.Day;
    }
}

使用例

通常

var dt = DateTime.Now;

Deconstruction

var ( year, month, day ) = DateTime.Now;



以上の内容はhttps://baba-s.hatenablog.com/entry/2019/09/03/230400より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14