I am working with WPF application and I want to assign a value of the var query to the ObservableCollection. So how can I assign it?
userDetail = Query as ObservableCollection<UserDatail>;
This will give me null.
My code is here
userDetail = new ObservableCollection<UserDatail>();
SampleDB conn = new SampleDB(Helper.GetPath());
var Query = from a in conn.UserInfo
select
a;
userDetail = Query as ObservableCollection<UserDatail>;
See I don’t want to use foreach loop to add this one by one.
Thanks…!!!
I think you want a collection of UserDatail and not UserInfo. If yes try this: