Quantcast
Channel: Visual Studio and Visual Web Developer Express
Viewing all articles
Browse latest Browse all 3509

Problem returning a list

$
0
0

Can anyone tell me where I need to look for this error - the {  aList}   is in red on my vs2012 ide screen.  Thanks

DonnieS

 

public List<x_BC_Account> LoadL()
    {
        List<x_BC_Account> aList = new List<x_BC_Account>();
        foreach (x_BC_Account record in new AccessPortalEntities1().x_BC_Accounts)
        {
            x_BC_Account xbcaccount = new x_BC_Account();
            xbcaccount.Account = record.Account;
            xbcaccount.Name = record.Name;
            xbcaccount.Suppr = record.Suppr;
            xbcaccount.Ind = record.Ind;
            aList.Add(xbcaccount);
        }
        return new List<x_BC_Account> { aList };
    }

I am getting these two errors - ?

Error 1 The best overloaded Add method 'System.Collections.Generic.List<AccessPortalModel.x_BC_Account>.Add(AccessPortalModel.x_BC_Account)' for the collection initializer has some invalid arguments C:\Stuff\H1\App_Code\DAL\AccountDAL.cs 103 41 C:\Stuff\H1\
Error 2 Argument 1: cannot convert from 'System.Collections.Generic.List<AccessPortalModel.x_BC_Account>' to 'AccessPortalModel.x_BC_Account' C:\Stuff\H1\App_Code\DAL\AccountDAL.cs 103 41 C:\Stuff\H1\

 


Viewing all articles
Browse latest Browse all 3509

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>