Remove allocations from Dns.* (dotnet/corefx#41061)
[mono-project.git] / mono / tests / marshal1.cs
blobfff98171cf8184b9c39767fae03979a5f7489256
1 using System;
2 using System.Runtime.InteropServices;
4 public class Test {
6 public static int Main () {
7 byte [] bytesrc = new byte [20];
8 byte [] bytedest = new byte [20];
10 IntPtr dest = Marshal.AllocHGlobal (1024);
12 bytesrc [2] = 2;
13 bytesrc [11] = 11;
14 Marshal.Copy (bytesrc, 2, dest, 10);
16 if (Marshal.ReadByte (dest, 0) != 2)
17 return 1;
18 if (Marshal.ReadByte (dest, 9) != 11)
19 return 1;
21 Marshal.Copy (dest, bytedest, 2, 10);
23 if (bytedest [2] != 2)
24 return 1;
25 if (bytedest [11] != 11)
26 return 1;
28 return 0;