I am trying to do
var mahByteArray = new ArrayList<byte>();
And it does not work. It says this:
The non-generic type 'System.Collectios.ArrayList' cannot be used with type arguments
What is the proper way to do declare a byte ArrayList?
You are confusing Java ArrayList collections with C# List generic collections. Both are used to declare collections, but the first one is used in Java as being a type defined in the generic class List for Collections framework and in the last one is used in C# language as an implicit generic type.
So, you must declare as being a List type. See details on List.
var mahByteArray = new List<byte>();
or
List<byte> mahByteArray = new List<byte>() { 2, 3, 4 };
sure you can use a ArrayList
var mahByteArray = new ArrayList();
mahByteArray.Add((byte) 230);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With