Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
/ corefx Public archive

Commit

Permalink
Add exception message per code review feedback
Browse files Browse the repository at this point in the history
This is the same exception message used by ReadOnlyCollection<T>.
  • Loading branch information
justinvp committed Jan 29, 2015
1 parent 1f003a4 commit 4104077
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 36 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions src/System.Text.RegularExpressions/src/Resources/Strings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,9 @@
<data name="NotEnoughParens" xml:space="preserve">
<value>Not enough )'s.</value>
</data>
<data name="NotSupported_ReadOnlyCollection" xml:space="preserve">
<value>Collection is read-only.</value>
</data>
<data name="OnlyAllowedOnce" xml:space="preserve">
<value>This operation is only allowed once per object.</value>
</data>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,28 +139,28 @@ int IList<Capture>.IndexOf(Capture item)

void IList<Capture>.Insert(int index, Capture item)
{
throw new NotSupportedException();
throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection);
}

void IList<Capture>.RemoveAt(int index)
{
throw new NotSupportedException();
throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection);
}

Capture IList<Capture>.this[int index]
{
get { return this[index]; }
set { throw new NotSupportedException(); }
set { throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection); }
}

void ICollection<Capture>.Add(Capture item)
{
throw new NotSupportedException();
throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection);
}

void ICollection<Capture>.Clear()
{
throw new NotSupportedException();
throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection);
}

bool ICollection<Capture>.Contains(Capture item)
Expand All @@ -186,17 +186,17 @@ bool ICollection<Capture>.IsReadOnly

bool ICollection<Capture>.Remove(Capture item)
{
throw new NotSupportedException();
throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection);
}

int IList.Add(object value)
{
throw new NotSupportedException();
throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection);
}

void IList.Clear()
{
throw new NotSupportedException();
throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection);
}

bool IList.Contains(object value)
Expand All @@ -211,7 +211,7 @@ int IList.IndexOf(object value)

void IList.Insert(int index, object value)
{
throw new NotSupportedException();
throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection);
}

bool IList.IsFixedSize
Expand All @@ -226,18 +226,18 @@ bool IList.IsReadOnly

void IList.Remove(object value)
{
throw new NotSupportedException();
throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection);
}

void IList.RemoveAt(int index)
{
throw new NotSupportedException();
throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection);
}

object IList.this[int index]
{
get { return this[index]; }
set { throw new NotSupportedException(); }
set { throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection); }
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,28 +170,28 @@ int IList<Group>.IndexOf(Group item)

void IList<Group>.Insert(int index, Group item)
{
throw new NotSupportedException();
throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection);
}

void IList<Group>.RemoveAt(int index)
{
throw new NotSupportedException();
throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection);
}

Group IList<Group>.this[int index]
{
get { return this[index]; }
set { throw new NotSupportedException(); }
set { throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection); }
}

void ICollection<Group>.Add(Group item)
{
throw new NotSupportedException();
throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection);
}

void ICollection<Group>.Clear()
{
throw new NotSupportedException();
throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection);
}

bool ICollection<Group>.Contains(Group item)
Expand All @@ -217,17 +217,17 @@ bool ICollection<Group>.IsReadOnly

bool ICollection<Group>.Remove(Group item)
{
throw new NotSupportedException();
throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection);
}

int IList.Add(object value)
{
throw new NotSupportedException();
throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection);
}

void IList.Clear()
{
throw new NotSupportedException();
throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection);
}

bool IList.Contains(object value)
Expand All @@ -242,7 +242,7 @@ int IList.IndexOf(object value)

void IList.Insert(int index, object value)
{
throw new NotSupportedException();
throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection);
}

bool IList.IsFixedSize
Expand All @@ -257,18 +257,18 @@ bool IList.IsReadOnly

void IList.Remove(object value)
{
throw new NotSupportedException();
throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection);
}

void IList.RemoveAt(int index)
{
throw new NotSupportedException();
throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection);
}

object IList.this[int index]
{
get { return this[index]; }
set { throw new NotSupportedException(); }
set { throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection); }
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,28 +171,28 @@ int IList<Match>.IndexOf(Match item)

void IList<Match>.Insert(int index, Match item)
{
throw new NotSupportedException();
throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection);
}

void IList<Match>.RemoveAt(int index)
{
throw new NotSupportedException();
throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection);
}

Match IList<Match>.this[int index]
{
get { return this[index]; }
set { throw new NotSupportedException(); }
set { throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection); }
}

void ICollection<Match>.Add(Match item)
{
throw new NotSupportedException();
throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection);
}

void ICollection<Match>.Clear()
{
throw new NotSupportedException();
throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection);
}

bool ICollection<Match>.Contains(Match item)
Expand All @@ -218,17 +218,17 @@ bool ICollection<Match>.IsReadOnly

bool ICollection<Match>.Remove(Match item)
{
throw new NotSupportedException();
throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection);
}

int IList.Add(object value)
{
throw new NotSupportedException();
throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection);
}

void IList.Clear()
{
throw new NotSupportedException();
throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection);
}

bool IList.Contains(object value)
Expand All @@ -243,7 +243,7 @@ int IList.IndexOf(object value)

void IList.Insert(int index, object value)
{
throw new NotSupportedException();
throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection);
}

bool IList.IsFixedSize
Expand All @@ -258,18 +258,18 @@ bool IList.IsReadOnly

void IList.Remove(object value)
{
throw new NotSupportedException();
throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection);
}

void IList.RemoveAt(int index)
{
throw new NotSupportedException();
throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection);
}

object IList.this[int index]
{
get { return this[index]; }
set { throw new NotSupportedException(); }
set { throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection); }
}
}

Expand Down

0 comments on commit 4104077

Please sign in to comment.