Click here to Skip to main content
14,882,705 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Cannot implicitly convert type 'System.Collections.Generic.List<sfm.models.bl.employeehistorylist>' to 'System.Collections.Generic.IEnumerable<sfm.models.bl.employeeregbl>'. An explicit conversion exists (are you missing a cast?)

any one tell me that whats type that error and whats that solution..please help me ..quickly..?
Posted

This is exactly what it is. You need a cast: http://msdn.microsoft.com/en-us/library/ms173105.aspx[^].

However, it's much more likely that you had to avoid cast, always a good idea, but failed due to wrong design of the code. As you show no code, we cannot help you more.

—SA
   
Comments
babarjan 24-Jan-13 4:12am
   
sir basicalli ian facing that error...can u guide me please..


"Error 37 Cannot implicitly convert type 'System.Collections.Generic.List<sfm.models.bl.employeehistorylist>' to 'System.Collections.Generic.IEnumerable<sfm.models.bl.employeeregbl>'. An explicit conversion exists (are you missing a cast?) C:\Documents and Settings\JavedAhmed\My Documents\Visual Studio 2010\Projects\SFM\SFM\Controllers\EmployeeHistoryController.cs 93 35 SFM"

please solve that error...
Sergey Alexandrovich Kryukov 24-Jan-13 12:37pm
   
There is no such thing as "solve this error". Solve based on what?!

Look at your code. Learn about assignability of variable/members of classes and interfaces taking into account inheritance.

Here is what I think: your question, especially this follow-up one, shows that you should not really "solve this". You really, really need to abandon the project for a while and learn the very elementary basics of programming. For now, you don't even have a clue how to ask a question, what to show, etc. Do something way simpler, before you gain confidence. Honestly, even it you get help, you won't be able to program.

—SA
try to adding .ToList(); and end.
   
You can Use .toArray().


C#
System.Collections.Generic.List<int> list = new System.Collections.Generic.List<int>( );
list.Add( 1 );
System.Collections.Generic.IEnumerable<int> enumer = list.ToArray( );
   

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