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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top