Closed 1andy11 closed 1 year ago
How have you defined dynamic_object.some_property
?
I have derived class from DynamicObject. Reading is working.
public class MyDynamicObject : DynamicObject
{
public override bool TryGetMember(GetMemberBinder binder, out object result)
{
...
}
public override bool TrySetMember(SetMemberBinder binder, object value)
{
...
}
}
The following C# code doesn't compile:
using System;
using System.Dynamic;
public class Program
{
public class MyDynamicObject : DynamicObject
{
}
public static void Main()
{
var dynamic_object = new MyDynamicObject();
dynamic_object.some_property = new Object();
}
}
Compilation error (line 13, col 19): 'Program.MyDynamicObject' does not contain a definition for 'some_property' and no extension method 'some_property' accepting a first argument of type 'Program.MyDynamicObject' could be found (are you missing a using directive or an assembly reference?)
Do you have a C# example that actually compiles?
Hello,
if I do the following statement interpreter.Parse("dynamic_object.some_property = x", new DynamicExpresso.Parameter[] { new Parameter("x", typeof(object)) }); I get the exception DynamicExpresso.Exceptions.ParseException: 'Expression must be writable (at index 30).'
Is it possible to achieve somehow such assignment?
Regards, Andrej.