In my C# code I have a class which stores some data I wish to pass down to my python code in a List. However, when I try to access properties of that class inside my python code I get MissingMemberException
. Here some example code to show what I mean:
C#:
class Event
{
public int EventId { get; set; }
public string EventName { get; set; }
}
//other processing here...
//this just fills the list with event objects
List<Event> eventList = GetEvents();
//this sets a variable in the ScriptScope
PythonEngine.SetVariable( "events", eventList);
PythonEngine.Execute("eventParser.py");
eventParser.py:
for e in events:
print e.EventId, " / ", e.EventName
The MissingMemberException
says "Event contains no member named EventId"
I have tested passing other types to the python, including lists of primitive types like List< int >
and List< string >
and they work fine.
So how do I access these class properties, EventId
and EventName
in my python script?