In C# what is the default value of the bytes when creating a new byte array?

后端 未结 3 1757
既然无缘
既然无缘 2021-01-18 04:50

The answer to this question has eluded my search.

When I do this:

  var authToken = new byte[16]; 

What is the value of authToken[0

3条回答
  •  无人共我
    2021-01-18 05:09

    If you would like to set empty array for Auto-Implemented Properties, you can do that way.

    public byte[] Attachement { get; set; } = Array.Empty();
    

    So when you create new class that this property belongs to, if it is empty, it will be store like 0x

提交回复
热议问题