Note that even your C++ code is badly written. Why the
immediate constant 6 is used (hard-coded)? Why don't you pass the length? What if the number of elements in the array is less? Besides, for
i=0
, your code will crash because the index will be out of range (-1). No, this is not a valid code.
In C#, it could be something like:
class CmsTest {
static void FirstTest(byte[] data) {
for (int index = 0; index < data.Length; ++index) {
}
}
}
Good luck,
—SA