ソースコード
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;