我有如下代码:
[DisplayName("Created")]
[DisplayFormat(DataFormatString = "{0:dd/MM/yyyy}")]
public DateTime? Created { get; set; }
[DisplayName("Modified By")]
public string ModifiedBy { get; set; }
[DisplayName("Modified")]
[DisplayFormat(DataFormatString = "{0:dd/MM/yyyy}")]
public DateTime? Modified { get; set; }
from d in data
select new Content.Grid
{
PartitionKey = d.PartitionKey,
RowKey = d.RowKey,
Order = d.Order,
Title = d.Title,e
Created = d.Created,
CreatedBy = d.CreatedBy,
Modified = d.Modified,
ModifiedBy = d.ModifiedBy
};
有可能d.Created
、d.CreatedBy
、d.Modified
和d.ModifiedBy
为空。
如果它们为空,我该如何设置才能使选择返回n/a
表示CreatedBy
和 ModifiedBy
,并为Created
和 Modified
返回日期January, 1, 2012
?