Click here to Skip to main content
15,881,898 members
Articles / Programming Languages / C# 4.0

how to return list using C#

Rate me:
Please Sign up or sign in to vote.
1.00/5 (2 votes)
6 Nov 2012CPOL 5.7K  
hello here my code public List getall(){ return db.banks.ToString();}and i m getting error likeCannot implicitly convert type 'string' to 'System.Collections.Generic.Listplease help me ...?

Alternatives

Members may post updates or alternatives to this current article in order to show different approaches or add new features.

Please Sign up or sign in to vote.
6 Nov 2012Ed Nutting
Erm...Can you seriously not see the problem here? If not, I suspect you should go back to basics and learn to program properly instead of guessing... The following should be obvious:Your method is declared as returning a List (public List getall()) yet you are returning a string (return...
Please Sign up or sign in to vote.
6 Nov 2012Ahmedwaheed
if you want to Retrun Generic List It have to be like thispublic List getall() { return db.banks.ToList(); }
Please Sign up or sign in to vote.
6 Nov 2012Perić Željko
List (T) Class[^]

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Comments and Discussions