Created
February 24, 2013 11:57
-
-
Save TryJSIL/5023560 to your computer and use it in GitHub Desktop.
Unsafe Code Test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
public static class Program { | |
public static unsafe void Main (string[] args) { | |
var ints = new int[] { 0, 1, 2, 3 }; | |
fixed (int* pInts = ints) { | |
var pBytes = (byte*)pInts; | |
for (var i = 0; i < (ints.Length * 4); i++) | |
pBytes[i] += 1; | |
} | |
foreach (var i in ints) | |
Console.WriteLine(i); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment