Click here to Skip to main content
12,952,277 members (41,570 online)
Rate this:
 
Please Sign up or sign in to vote.
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 23-Jan-13 21:24pm
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

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
  Permalink  
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
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

try to adding .ToList(); and end.
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 3

You can Use .toArray().


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

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

    Print Answers RSS
Top Experts
Last 24hrsThis month
OriginalGriff 6,289
CHill60 3,490
Maciej Los 3,103
Jochen Arndt 1,975
ppolymorphe 1,900


Advertise | Privacy | Mobile
Web02 | 2.8.170525.1 | Last Updated 24 Jan 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100