如何在参数中分配时间戳格式值?

时间:2013-05-31 14:14:39

标签: c# asp.net-mvc-4

[Timestamp]
public byte[] Timestamp { get; set; }

如何为Timestamp分配虚拟值?

2 个答案:

答案 0 :(得分:1)

如果你只是想避免空值:

Timestamp = new byte[0];

答案 1 :(得分:0)

试试这个: -

public class Time
{
    [Timestamp]
    private Lazy<byte[]> _timestamp=new Lazy<byte[]>();

    [Timestamp]
    public Lazy<byte[]> Timestamp
    {
        get
        {
            return _timestamp;
        }

        set { _timestamp = value; }
    }
}