aboutsummaryrefslogtreecommitdiff
path: root/csharp/src/Google.Protobuf/Collections/RepeatedField.cs
diff options
context:
space:
mode:
authorJan Tattermusch <jtattermusch@google.com>2015-07-29 16:05:57 -0700
committerJan Tattermusch <jtattermusch@google.com>2015-07-29 20:26:20 -0700
commit3783d9a8add33b240e326438fa0b16869dbcfb44 (patch)
treeda62a6324d13214803065ec47c36867aeae755f5 /csharp/src/Google.Protobuf/Collections/RepeatedField.cs
parent74810c6ae3219498dd3e856f9cd251588c92a899 (diff)
downloadprotobuf-3783d9a8add33b240e326438fa0b16869dbcfb44.tar.gz
protobuf-3783d9a8add33b240e326438fa0b16869dbcfb44.tar.bz2
protobuf-3783d9a8add33b240e326438fa0b16869dbcfb44.zip
remove the freeze API
Diffstat (limited to 'csharp/src/Google.Protobuf/Collections/RepeatedField.cs')
-rw-r--r--csharp/src/Google.Protobuf/Collections/RepeatedField.cs29
1 files changed, 3 insertions, 26 deletions
diff --git a/csharp/src/Google.Protobuf/Collections/RepeatedField.cs b/csharp/src/Google.Protobuf/Collections/RepeatedField.cs
index ccd1a9bb..e7fc0a3f 100644
--- a/csharp/src/Google.Protobuf/Collections/RepeatedField.cs
+++ b/csharp/src/Google.Protobuf/Collections/RepeatedField.cs
@@ -43,7 +43,7 @@ namespace Google.Protobuf.Collections
/// restrictions (no null values) and capabilities (deep cloning and freezing).
/// </summary>
/// <typeparam name="T">The element type of the repeated field.</typeparam>
- public sealed class RepeatedField<T> : IList<T>, IList, IDeepCloneable<RepeatedField<T>>, IEquatable<RepeatedField<T>>, IFreezable
+ public sealed class RepeatedField<T> : IList<T>, IList, IDeepCloneable<RepeatedField<T>>, IEquatable<RepeatedField<T>>
{
private static readonly T[] EmptyArray = new T[0];
private const int MinArraySize = 8;
@@ -190,21 +190,6 @@ namespace Google.Protobuf.Collections
}
}
- public bool IsFrozen { get { return frozen; } }
-
- public void Freeze()
- {
- frozen = true;
- IFreezable[] freezableArray = array as IFreezable[];
- if (freezableArray != null)
- {
- for (int i = 0; i < count; i++)
- {
- freezableArray[i].Freeze();
- }
- }
- }
-
private void EnsureSize(int size)
{
if (array.Length < size)
@@ -223,14 +208,12 @@ namespace Google.Protobuf.Collections
{
throw new ArgumentNullException("item");
}
- this.CheckMutable();
EnsureSize(count + 1);
array[count++] = item;
}
public void Clear()
{
- this.CheckMutable();
array = EmptyArray;
count = 0;
}
@@ -247,7 +230,6 @@ namespace Google.Protobuf.Collections
public bool Remove(T item)
{
- this.CheckMutable();
int index = IndexOf(item);
if (index == -1)
{
@@ -261,7 +243,7 @@ namespace Google.Protobuf.Collections
public int Count { get { return count; } }
- public bool IsReadOnly { get { return IsFrozen; } }
+ public bool IsReadOnly { get { return false; } }
public void Add(RepeatedField<T> values)
{
@@ -269,7 +251,6 @@ namespace Google.Protobuf.Collections
{
throw new ArgumentNullException("values");
}
- this.CheckMutable();
EnsureSize(count + values.count);
// We know that all the values will be valid, because it's a RepeatedField.
Array.Copy(values.array, 0, array, count, values.count);
@@ -282,7 +263,6 @@ namespace Google.Protobuf.Collections
{
throw new ArgumentNullException("values");
}
- this.CheckMutable();
// TODO: Check for ICollection and get the Count?
foreach (T item in values)
{
@@ -372,7 +352,6 @@ namespace Google.Protobuf.Collections
{
throw new ArgumentOutOfRangeException("index");
}
- this.CheckMutable();
EnsureSize(count + 1);
Array.Copy(array, index, array, index + 1, count - index);
array[index] = item;
@@ -385,7 +364,6 @@ namespace Google.Protobuf.Collections
{
throw new ArgumentOutOfRangeException("index");
}
- this.CheckMutable();
Array.Copy(array, index + 1, array, index, count - index - 1);
count--;
array[count] = default(T);
@@ -407,7 +385,6 @@ namespace Google.Protobuf.Collections
{
throw new ArgumentOutOfRangeException("index");
}
- this.CheckMutable();
if (value == null)
{
throw new ArgumentNullException("value");
@@ -417,7 +394,7 @@ namespace Google.Protobuf.Collections
}
#region Explicit interface implementation for IList and ICollection.
- bool IList.IsFixedSize { get { return IsFrozen; } }
+ bool IList.IsFixedSize { get { return false; } }
void ICollection.CopyTo(Array array, int index)
{