How to get fixed buffer length?
Solution 1:
Well like in C++, you have to keep size of built-in arrays. Same applies for fixed buffers in C#. This type is comparable to inline_array
. This gives you benefits such as static code checking. They are a bit of a pain to work with as they aren't C#'s first class feature. So probably the best solution is to keep size as a part of struct. You will probably just have to deal with it or use a collection/C#'s System.Array
. Maybe another solution would be to create fixed buffer as a seperate struct and then make it part of another stucts with other data.