Skip to content

Commit

Permalink
Remove ExtensionRegistry.Add(params) overload
Browse files Browse the repository at this point in the history
  • Loading branch information
ObsidianMinor authored and jtattermusch committed Jul 23, 2019
1 parent 325ed81 commit 5f2ec57
Showing 1 changed file with 7 additions and 17 deletions.
24 changes: 7 additions & 17 deletions csharp/src/Google.Protobuf/ExtensionRegistry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ private ExtensionRegistry(IDictionary<ObjectIntPair<Type>, Extension> collection
/// </summary>
bool ICollection<Extension>.IsReadOnly => false;

internal bool ContainsInputField(CodedInputStream stream, Type target, out Extension extension)
{
return extensions.TryGetValue(new ObjectIntPair<Type>(target, WireFormat.GetTagFieldNumber(stream.LastTag)), out extension);
internal bool ContainsInputField(CodedInputStream stream, Type target, out Extension extension)
{
return extensions.TryGetValue(new ObjectIntPair<Type>(target, WireFormat.GetTagFieldNumber(stream.LastTag)), out extension);
}

/// <summary>
Expand All @@ -82,16 +82,6 @@ public void Add(Extension extension)
extensions.Add(new ObjectIntPair<Type>(extension.TargetType, extension.FieldNumber), extension);
}

/// <summary>
/// Adds the specified extensions to the registry
/// </summary>
public void Add(params Extension[] newExtensions)
{
ProtoPreconditions.CheckNotNull(newExtensions, nameof(newExtensions));

Add((IEnumerable<Extension>)newExtensions);
}

/// <summary>
/// Adds the specified extensions to the reigstry
/// </summary>
Expand Down Expand Up @@ -134,10 +124,10 @@ void ICollection<Extension>.CopyTo(Extension[] array, int arrayIndex)
if (array.Length - arrayIndex < Count)
throw new ArgumentException("The provided array is shorter than the number of elements in the registry");

for (int i = 0; i < array.Length; i++)
{
Extension extension = array[i];
extensions.Add(new ObjectIntPair<Type>(extension.TargetType, extension.FieldNumber), extension);
for (int i = 0; i < array.Length; i++)
{
Extension extension = array[i];
extensions.Add(new ObjectIntPair<Type>(extension.TargetType, extension.FieldNumber), extension);
}
}

Expand Down

0 comments on commit 5f2ec57

Please sign in to comment.