I ran some code analysis on my audio streaming solution today and learned something new:

There is a recommendation within the code analysis engine that looks for cases where the List(of T) type is exposed as a public property or on a public method of a class. The recommendation is to use something like System.Collections.ObjectModel.Collection(of T) instead.

This seemed kind of strange to me, so I looked into it a bit. Here an article from the code analysis team blog that explains the rational:


I'm still looking into this a bit. There may be consequences to completely cutting over to Collection(of T) that we don't know yet, so I won't go rewrite things yet. But, I'm going to consider using Collection(of T) instead of List(of T) when passing data over the public interface of a class (or web service).