Link to home
Start Free TrialLog in
Avatar of mathew_s
mathew_s

asked on

Convert List to IENumerable Collection

I am getting an error in the DataProvider.TmpOpps.Load(TmpOppList3) that there is some invalid argument.
The commented out piece of code works //DataProvider.TmpOpps.Load(e.Result.TargetList);
The lines with comments of NEW are ones that I put in trying to get it to work. What I wanted to do is filter the dataset before passing it to the load but am having a difficult time figuring this out. Any help?


 
        void _client_TemporaryOpportunityDeploymentServiceCompleted(object sender, TemporaryOpportunityDeploymentServiceCompletedEventArgs e)
        {
            switch (e.Result.Operation)
            {
                case Operations.CommonGetAll:
                    ObservableCollection<TemporaryOpportunityDeployment> TmpOppList2 = new ObservableCollection<TemporaryOpportunityDeployment>(); //*NEW

                    TmpOppList2 = e.Result.TargetList;  //*NEW
                    var TmpOppList3 = TmpOppList2.Where(x => x.OppEndDate>DateTime.Now);  //*NEW

                    if (e.Result.Succeeded) DataProvider.TmpOpps.Load(TmpOppList3); //DataProvider.TmpOpps.Load(e.Result.TargetList); //*NEW
                    else { _refreshFailed = true; _refreshErrors.Add(e.Result.ErrorMessage); }
                    FinishSetAndCheckCompletion(DataSets.TmpOpps);
                    break;

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of mathew_s
mathew_s

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial