If a calling code is in accordance with the collection, then instead of exposing an internal archive in the form of readonly collection instead of an iEnemable Is there any reason?
As I see the IEnumerable readOnlyCollection is a subset of the interface and it does not allow the user to modify the archive. So if the IEnumberable interface is enough then it's the one to use. Is there a proper way to reason on this, or am I forgetting something?
Thank you / Eric
(edit)
Is the calling code only available on the collection, if there is any reason to expose an internal archive in the form of readonly collection instead of any IEmable?
It depends how much you believe in the calling code. If you ever call this member, and you will never use any code on Guarantee , then you are fully in control of it:
IconKining & Lt; Foo & gt; Evil = (Icillation & lt; Foo & gt;) Bar Fuse; Evil.Add (...);
Then you return directly to the collection, then no harm will be done. I usually try to be a bit crazy.
Similarly, as you say: If you only need need IEnumerable & lt; T & gt;
Why tie yourself to strengthen anything?
Original Answer
If you are using .NET 3.5, you can leave a simple call except and Avoid calls:
Public INIM Marketplace & lt; Foo & gt; Foze {Return Foze Skip (0); }}
(There are a lot of other options to wrap briefly - Good thing about Skip
about selection / Where is it that For any representative repetition to execute without any unmatched.)
If you are not using .NET 3.5 then you can write a very simple cover to do the same thing:
Public stable IEnumerable & lt; T & gt; Wrappers & lt; T & gt; (IEnumerable & lt; T & gt; source) {foreach (T element in source) {yield returns element; }}
Comments
Post a Comment