Convert List or Ilist to ObservableCollection

Deveder
Posted by Deveder under Silverlight category on | Points: 40 | Views : 6920
private ObservableCollection<T> GetObservableCopy<T>(IList<T> iList)
{
ObservableCollection<T> observableCollection = new ObservableCollection<T>();
try
{
if (iList != null && iList.Count > 0)
{
foreach (T item in iList)
{
observableCollection.Add(ModelBase.Clone<T>(item);
}
}
}
catch (Exception exception)
{
//Throw New exception;
}
return observableCollection;
}

Comments or Responses

Posted by: Tijut2k on: 7/11/2011 Level:Starter | Status: [Member] | Points: 10
Share the exact difference b/w observableCollection<T> and IList<T>

Login to post response