1 // Compiler options: -unsafe
7 static unsafe void CopyTo (int sourceIndex
, char[] destination
, int destinationIndex
, int count
)
9 string s
= "test string-";
10 fixed (char* dest
= destination
, src
= s
)
12 CharCopy (dest
+ destinationIndex
, src
+ sourceIndex
, count
);
16 static unsafe void CharCopy (char *dest
, char *src
, int count
)
18 for (int i
= 0; i
< count
; i
++) {
23 public static int Main ()
25 CopyTo (5, null, 0, 0);
27 char[] output
= new char [6];
28 CopyTo (5, output
, 0, 6);
29 string s
= new string (output
);
30 Console
.WriteLine (s
);