Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public SampleIReadOnlyList
- {
- readonly List<int> someProperty = new List<int> {
- 1,2,3,
- }
- public IReadOnlyList<int> SomeProperty {
- get { return someProperty; }
- }
- }
- void foo()
- {
- var x = new SampleIReadOnlyList;
- x.SomeProperty[0] = 1; // エラー。 IReadOnlyList<T> のインデクサには setter メソッドが無い。
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement