Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Insert for SlimReadOnlyListWrapper unsupported #6103

Merged
merged 2 commits into from
Jan 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
24 changes: 12 additions & 12 deletions osu.Framework/Lists/SlimReadOnlyListWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,21 @@ public SlimReadOnlyListWrapper(List<T> list)

IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();

public void Add(T item) => throw new NotImplementedException();
public void Add(T item) => throw new NotSupportedException();

public int Add(object? value) => throw new NotImplementedException();
public int Add(object? value) => throw new NotSupportedException();

void IList.Clear() => throw new NotImplementedException();
void IList.Clear() => throw new NotSupportedException();

public bool Contains(object? value) => ((IList)list).Contains(value);

public int IndexOf(object? value) => ((IList)list).IndexOf(value);

public void Insert(int index, object? value) => ((IList)list).Insert(index, value);
public void Insert(int index, object? value) => throw new NotSupportedException();

public void Remove(object? value) => throw new NotImplementedException();
public void Remove(object? value) => throw new NotSupportedException();

void IList.RemoveAt(int index) => throw new NotImplementedException();
void IList.RemoveAt(int index) => throw new NotSupportedException();

public bool IsFixedSize => ((IList)list).IsFixedSize;

Expand All @@ -51,16 +51,16 @@ public SlimReadOnlyListWrapper(List<T> list)
object? IList.this[int index]
{
get => ((IList)list)[index];
set => throw new NotImplementedException();
set => throw new NotSupportedException();
}

void ICollection<T>.Clear() => throw new NotImplementedException();
void ICollection<T>.Clear() => throw new NotSupportedException();

public bool Contains(T item) => list.Contains(item);

public void CopyTo(T[] array, int arrayIndex) => list.CopyTo(array, arrayIndex);

public bool Remove(T item) => throw new NotImplementedException();
public bool Remove(T item) => throw new NotSupportedException();

public void CopyTo(Array array, int index) => ((ICollection)list).CopyTo(array, index);

Expand All @@ -76,14 +76,14 @@ public SlimReadOnlyListWrapper(List<T> list)

public int IndexOf(T item) => list.IndexOf(item);

public void Insert(int index, T item) => throw new NotImplementedException();
public void Insert(int index, T item) => throw new NotSupportedException();

void IList<T>.RemoveAt(int index) => throw new NotImplementedException();
void IList<T>.RemoveAt(int index) => throw new NotSupportedException();

public T this[int index]
{
get => list[index];
set => throw new NotImplementedException();
set => throw new NotSupportedException();
}
}
}