Click here to Skip to main content
15,867,568 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I am calling a method:
C#
lstMessages = UserDetailsService.GetMessagesForUser((thisUserID.Id).ToString()).ToList();

While stepping through the code without the lstMessages on the left it works fine, but when I set it to equal I get the error.

Kind of new to Generics.

Why am I getting this error?
Posted
Updated 13-Dec-12 9:14am
v2
Comments
Akbar Ali Hussain 13-Dec-12 15:04pm    
What is the type of lstMessages?
DinoRondelly 13-Dec-12 15:10pm    
How did you declare lstMessages ?

1 solution

The error message is pretty straightforward

It can't convert from the type on the right, to the type on the left.

The type of lstMessages should be as the right hand side functions return (which is a Generic List).
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 13-Dec-12 17:20pm    
Right, a 5.
--SA
wizardzz 13-Dec-12 17:26pm    
Thanks Sergey.

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900