What's the Best Way?

  • Thread starter Thread starter C# Learner
  • Start date Start date
C

C# Learner

What's the best way to achieve the following?

public class MyClass
{
public const byte[] TwoConstBytes = new byte[] { 0x01, 0x02 };
}
 
public const byte[] TwoConstBytes = new byte[] { 0x01, 0x02 };

public static readonly byte[] TwoConstBytes = ...

Note that this makes the array reference read-only, but not the array
content.



Mattias
 
Back
Top