why does resharper suggest making data structures more generic?

I notice, in methods, that when I use specific datastructures (such as a List) that Rider suggests that I use a more generic alternatives. In my case I typically want my methods to return a List and so i my annotate my function with an IList interface: 

private IList<LinePage> GetAllLines()
{
// Implementation
}

Rider suggests that I use IEnumarable instead. I get that it still works but are'nt there any performance overhead by using a more generic version of a data structure when you already know what type of data structure you want? I am aware of the power if interitance but still

0
1 comment

Hello Laurent Baj,

Thank you for reaching Rider Forum.

You may want to disable this inspection in Settings/Preferences > Editor > Inspection Settings > Inspection Severity > C# > uncheck Parameter type can be Enumerable.

Please let me know if any questions appear! 

 

0

Please sign in to leave a comment.