Forum Xamarin Xamarin.iOS

Experimental Dynamic Support in 7.2

RBellRBell USMember

I noticed in the release notes that there's experimental support for C# dynamic. I've been working on an AOP project to allow for some authentication decorators using Mono.Cecil and Microsoft Build tasks. It said you're looking for early adopters, is this something I can leverage?

Posts

  • RodjaTrappeRodjaTrappe DEBeta ✭✭

    I really would like to use C# dynamic support to simplify accessing json data:

    var json = "{ 'Name' : 'test', 'Id' : '33445' }";
    dynamic data = JsonConvert.DeserializeObject<ExpandoObject>(json);
    Console.WriteLine(data.Name);
    

    But it seems the current implementation does not support accessing anything in a dynamic fashion:

    dynamic data = new { Name = "test" };
    Console.WriteLine (data.Name);
    

    Produces these compiler errors:

    Error CS0518: The predefined type `Microsoft.CSharp.RuntimeBinder.Binder' is not defined or imported (CS0518) (DynamicSupportOniOS)
    ~/Spikes/DynamicSupportOniOS/AppDelegate.cs(28,28): Error CS1969: Dynamic operation cannot be compiled without `Microsoft.CSharp.dll' assembly reference (CS1969) (DynamicSupportOniOS)
    

    Hope this will be possible in the future.

Sign In or Register to comment.