Skip to content

Commit 1d59f73

Browse files
committed
Update examples
1 parent aefa797 commit 1d59f73

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

example/Class1.cs renamed to example/TestClass.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,18 @@
22
using System.Runtime.InteropServices;
33
using System;
44

5-
namespace example
5+
namespace Example
66
{
7-
public class Class1
7+
public class TestClass
88
{
99
public static int Test(IntPtr arg, int size) {
1010
var buf = new byte[size];
11-
Marshal.Copy(arg, buf);
11+
Marshal.Copy(arg, buf, 0, size);
1212
var bufAsString = Encoding.UTF8.GetString(buf);
1313
var result = bufAsString.Length;
14-
Console.WriteLine($"Called {nameof(Test)} in {nameof(Class1)} with {bufAsString}, returning {result}");
14+
Console.WriteLine($"Called {nameof(Test)} in {nameof(TestClass)} with {bufAsString}, returning {result}");
15+
Console.WriteLine($"Binary data: {Convert.ToBase64String(buf)}");
16+
1517
return result;
1618
}
1719
}

0 commit comments

Comments
 (0)