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

如何为 Timestamp 分配一个虚拟值?

4

2 回答 2

1

如果您只是想避免空值:

Timestamp = new byte[0];
于 2013-05-31T14:16:57.477 回答
0

试试这个: -

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

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

        set { _timestamp = value; }
    }
}
于 2013-05-31T15:33:41.407 回答