Generic versions of Create () are no longer supported and deprecated

AlvaroRivoirAlvaroRivoir USMember ✭✭✭

When updated to Xamarin.Forms 2.1 I got the following compilation error

_ Generic versions of Create () are no longer supported and deprecated_

Why? It looks as a step backwards.

Best Answers

Answers

  • MichaelRumplerMichaelRumpler ATMember ✭✭✭✭✭

    We already discussed that in the release notes.

  • AlvaroRivoirAlvaroRivoir USMember ✭✭✭

    Hi Michael,

    Deprecating the generic method just because the nameof function appeared doesn't look as a smart argument. Specially when the generic method has no problem, has it?

    Regards,
    Alvaro.

  • AdamMeaneyAdamMeaney USMember ✭✭✭✭✭

    I can't find it right now, but Jason said there was a performance hit in iOS for some reason with the generic versions.

  • AdamMeaneyAdamMeaney USMember ✭✭✭✭✭

    Just for reference, to copy Jason's response from the referenced thread:

    yeah we don't like it either, and if you want to use the expression API go ahead, we wont be removing it in the 2.0 series at all, but be aware that there is nothing we can do about the iOS bloat due to AOT requirement. Without a JIT expression is extremely bloated and slow.

  • rahtriparahtripa USMember ✭✭
    edited April 2018

    Deprecated .

       public static readonly BindableProperty ProgressValueProperty =
            BindableProperty.Create<MyControl, double>
       (p => p.Value, double.NaN, BindingMode.TwoWay, propertyChanged: (bindable, oldValue, newValue) =>
       {
           var control = (MyControl)bindable;
           control.Value = newValue;
       });
    

    New version:

     public static readonly  BindableProperty ProgressValueProperty = BindableProperty.Create("Value", typeof(double), 
     typeof(MyControl), null, BindingMode.TwoWay, null, propertyChanged: OnItemsSourceChanged);
      static void OnItemsSourceChanged(BindableObject bindable, object oldValue, object newValue)
        {
            var control = (MyControl)bindable;
            control.Value = (double)newValue;
        }
    
  • rahtriparahtripa USMember ✭✭
    edited April 2018

    Deprecated .

           public static readonly BindableProperty ProgressValueProperty =
                BindableProperty.Create<MyControl, double>
           (p => p.Value, double.NaN, BindingMode.TwoWay, propertyChanged: (bindable, oldValue, newValue) =>
           {
               var control = (MyControl)bindable;
               control.Value = newValue;
           });
    

    New version:

     public static readonly  BindableProperty ProgressValueProperty = BindableProperty.Create("Value", typeof(double), 
     typeof(MyControl), double.NaN, BindingMode.TwoWay, null, propertyChanged: OnItemsSourceChanged);
      static void OnItemsSourceChanged(BindableObject bindable, object oldValue, object newValue)
        {
            var control = (MyControl)bindable;
            control.Value = (double)newValue;
        }
    
Sign In or Register to comment.