我有一个属性返回两个类型的项目DateTime。返回这些值时,我必须将它们引用为Item1and Item2。我如何返回自定义名称,例如
filter?.DateRanges.From
filter?.DateRanges.To
public Tuple<DateTime, DateTime> DateRanges
{
get
{
From = DateTime.Now.AddDays(-1).Date.AddMonths(-1);
To = DateTime.Now.AddDays(-1).Date;
if (Preset != 0)
{
if (Preset == DatePreset.SpecificRange)
{
From = From.Date;
To = To.Date;
}
else
{
var dateRange = DateTime.Today.AddDays(-1).GetDateRangeByPreset(Preset);
From = dateRange.From;
To = dateRange.To;
}
}
return new Tuple<DateTime, DateTime>(From, To);
}
用法:
var from = filter?.DateRanges.Item1;
var to = filter?.DateRanges.Item2;
皈依舞
月关宝盒
相关分类