public static void Main() { eina.Config.Init(); efl.eo.Config.Init(); var obj = new example.Numberwrapper(); // Set internal value obj.SetNumber(12); // With static method obj.SetNumberCallback(twiceCb); var ret = obj.CallCallback(); WriteLine($"Callback called? {static_called}."); WriteLine($"Returned value: {ret}.\n"); // With lambda bool lamda_called = false; obj.SetNumberCallback(n => { lamda_called = true; return(n * 3); }); ret = obj.CallCallback(); WriteLine($"Lambda called? {lamda_called}."); WriteLine($"Returned value: {ret}.\n"); }
public static void Main() { eina.Config.Init(); efl.eo.Config.Init(); var inheritObj = new PlusTenNumberWrapper(); WriteLine("## Using inherit object ##\n"); int given = 111; // Call the C# override from the C method inheritObj.CallNumberSet(given); WriteLine($"Override successfully called? {inheritObj.derivedCalled}!\n"); // Call C function from C# object int stored = inheritObj.GetNumber(); WriteLine($"Given value: {given}"); WriteLine($"Stored value: {stored}\n"); // Call C# override directly given = 333; inheritObj.SetNumber(given); stored = inheritObj.GetNumber(); WriteLine($"Given value: {given}"); WriteLine($"Stored value: {stored}\n"); WriteLine("## Using original object ##\n"); // Check original EFL object var origObj = new example.Numberwrapper(); given = 111; origObj.SetNumber(given); stored = origObj.GetNumber(); WriteLine($"Given value: {given}"); WriteLine($"Stored value: {stored}\n"); }