I know I shouldn\'t be exposing a List
in a property, but I wonder what the proper way to do it is? For example, doing this:
public static
If you expose your list as IEnumerable, I wouldn't worry about callers casting back to List. You've explicitly indicated in the contract of your class that only the operations defined in IEnumerable are allowed on this list. So you have implicitly stated that the implementation of that list could change to pretty much anything that implements IEnumerable.