Wednesday, 23 November 2016
c# - List or IList
Answer
Answer
Can anyone explain to me why I would want to use IList over List in C#?
Related question: Why is it considered bad to expose List
Answer
If you are exposing your class through a library that others will use, you generally want to expose it via interfaces rather than concrete implementations. This will help if you decide to change the implementation of your class later to use a different concrete class. In that case the users of your library won't need to update their code since the interface doesn't change.
If you are just using it internally, you may not care so much, and using List may be ok.
c++ - Does curly brackets matter for empty constructor?
Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...
-
I found this excellent tutorial on regular expressions and while I intuitively understand what "greedy", "reluctant" an...
-
In K-PAX , there are two possible explanations: Prot is crazy. He is truly an alien. There are facts that indicate 1, but also 2. Examples: ...
-
Why this works? I mean, accessing the private variable. class Test { private $q = 0; public function __construct() { $this-...
No comments:
Post a Comment