C#C
C#3y ago
BenMcLean

❔ Casting range to bytes?

byte[] bytes = Enumerable.Range(0, 256).Cast<byte>().ToArray();
The result: System.InvalidCastException : Unable to cast object of type 'System.Int32' to type 'System.Byte'.
Why?
This should work!
Why doesn't this work!?
Was this page helpful?