data binding - Convert in ObservableCollection (C# uwp) -


i writing app uwp.

i tried use data binding according answer link.

here classes:

 public class billing     {         public string first_name { get; set; }         public string last_name { get; set; }         public string company { get; set; }         public string address_1 { get; set; }         public string address_2 { get; set; }         public string city { get; set; }         public string state { get; set; }         public string postcode { get; set; }         public string country { get; set; }         public string email { get; set; }         public string phone { get; set; }               }      public class shipping     {         public string first_name { get; set; }         public string last_name { get; set; }         public string company { get; set; }         public string address_1 { get; set; }         public string address_2 { get; set; }         public string city { get; set; }         public string state { get; set; }         public string postcode { get; set; }         public string country { get; set; }     }      public class rootobject     {         public int id { get; set; }         public int parent_id { get; set; }         public string status { get; set; }          public string order_key { get; set; }         public string currency { get; set; }         public string version { get; set; }         public bool prices_include_tax { get; set; }         public string date_created { get; set; }         public string date_modified { get; set; }         public int customer_id { get; set; }         public double discount_total { get; set; }         public double discount_tax { get; set; }         public double shipping_total { get; set; }         public double shipping_tax { get; set; }         public double cart_tax { get; set; }         public double total { get; set; }         public double total_tax { get; set; }         public billing billing { get; set; }         public shipping shipping { get; set; }         public string payment_method { get; set; }         public string payment_method_title { get; set; }         public string transaction_id { get; set; }         public string customer_ip_address { get; set; }         public string customer_user_agent { get; set; }         public string created_via { get; set; }         public string customer_note { get; set; }         public string date_completed { get; set; }         public string date_paid { get; set; }         public string cart_hash { get; set; }         public list<object> line_items { get; set; }         public list<object> tax_lines { get; set; }         public list<object> shipping_lines { get; set; }         public list<object> fee_lines { get; set; }         public list<object> coupon_lines { get; set; }     }      public observablecollection<rootobject> orders { get; set; } 

here code:

list<rootobject> rootobjectdata = jsonconvert.deserializeobject<list<rootobject>>(products); foreach (rootobject root in rootobjectdata) {     string date = root.date_created;     string name = root.billing.first_name + root.billing.last_name ;     orders = new observablecollection<rootobject> { new rootobject { date_created = date,billing = name } }; } 

with billing = name have error: cannot implicitly convert type 'string' 'milano.inwork.billing'

how can fix error? maybe simple, don't find solution. help!!

with billing = name have error: cannot implicitly convert type 'string' 'milano.inwork.billing'

of course error occur, billing in class rootobject has data type billing, class defined.

just code think want show first_name , last_name string in root.billing, can change code public billing billing { get; set; } in rootobject class public string billing { get; set; }.


Comments

Popular posts from this blog

unity3d - Rotate an object to face an opposite direction -

angular - Is it possible to get native element for formControl? -

javascript - Why jQuery Select box change event is now working? -