0

What is the difference between the below 2 lines of code?

IList<Product> products = new List<Product>();

List<Product> products = new List<Product>();

I know I'm asking difference between IList & List, but what is the difference in above 2 lines of code?

Moreover, what are the advantages/disadvantages one over other? Is there any performance issue?

Simply what happens behind the scenes when using one over other? Thanks!

Jay Sullivan
  • 16,041
  • 10
  • 57
  • 81
user584018
  • 8,077
  • 12
  • 50
  • 108
  • 2
    I can't wait till the day someone asks "what is the difference between X and Y?" without making **any** mention of performance whatsoever - not even through implication. – BoltClock Apr 25 '14 at 04:04
  • 1
    Nothing wrong with the question other than a duplicate. Close it, don't down vote it. – andleer Apr 25 '14 at 04:08
  • 1
    There is no difference of significance. One you are accessing through an interface, the other a concrete implementation. The duplicate has much more information on the topic :) – BradleyDotNET Apr 25 '14 at 04:09

0 Answers0