I think Collections (both readonly collections and not) are very common case in Object Model. Could you please add some sample for it?
I can't find any resource on it from MSDN and internet. :(
Please please think it seriously and do me a favor :(
We don't have a sample that was specifically built to demo collections but several of them have examples of how to use collections. Take a look at the WPF Calculator sample here:
Sample- WPF Caclulator
You can take a quick look at the source online without even downloading the sample: http://www.codeplex.com/clraddins/SourceControl/FileView.aspx?itemId=88258&changeSetId=9102
You'll see in the contract for this sample there is the following interfaces:
public interface IVisualCalculatorContract : IContract
System.AddIn.Contract.INativeHandleContract Operate(IOperationContract op, double operands);
public interface IOperationContract : IContract
In those interfaces the add-in is returning an IListContract<IOperationContract> to the host. In the add-in and host view that gets represented as IList<IOperation>.
In this case we are showing a contract representation of IList<T> and the actual type the add-in uses is List<IOperation>. The add-in instead could have instantiated a ReadOnlyCollection<T> (which implements IList<T>) and if it had done
so it would end up having read-only semantics. You can download the sample, modify the code a bit, and give it a try.
Let me know if you have any other questions about this.