-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
36 lines (29 loc) · 842 Bytes
/
Program.cs
File metadata and controls
36 lines (29 loc) · 842 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using Python.Runtime;
namespace Testing;
internal class Person
{
public string FirstName { get; set; }
public string LastName { get; set; }
public Person(string firstname, string lastname)
{
FirstName = firstname;
LastName = lastname;
}
public string GetFullName() => FirstName + " " + LastName;
}
public static class Program
{
public static void Main(string[] argv)
{
Runtime.PythonDLL = @"C:\Users\lavap\AppData\Local\Programs\Python\Python312\python312.dll";
PythonEngine.Initialize();
using (Py.GIL())
{
using (var scope = Py.CreateScope())
{
scope.Set("Person", PyType.Get(typeof(Person)));
scope.Exec("print(Person('Lilith', 'Winterlight').GetFullName())");
}
}
}
}