code_junkie

Large array arithmetics in C#

Nov 11th, 2011
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.21 KB | None | 0 0
  1. int[] array = Enumerable.Range(0, 1000).ToArray();
  2.  
  3. int count = 0;
  4. unsafe {
  5. fixed (int* pArray = array) {
  6. for (int i = 0; i < array.Length; i++) {
  7. count += *(pArray + i);
  8. }
  9. }
  10. }
Add Comment
Please, Sign In to add comment