CR feedback from attribute dictionary

This commit is contained in:
Ryan Nowak 2015-10-05 10:38:46 -07:00
parent ad3c257ef5
commit 32c174c791
1 changed files with 9 additions and 18 deletions

View File

@ -4,6 +4,7 @@
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
namespace Microsoft.AspNet.Mvc.ViewFeatures namespace Microsoft.AspNet.Mvc.ViewFeatures
{ {
@ -105,20 +106,14 @@ namespace Microsoft.AspNet.Mvc.ViewFeatures
private KeyValuePair<string, string> Get(int index) private KeyValuePair<string, string> Get(int index)
{ {
if (index >= Count) Debug.Assert(index >= 0 && index < Count);
{
throw new ArgumentOutOfRangeException();
}
return _items[index]; return _items[index];
} }
private void Set(int index, KeyValuePair<string, string> value) private void Set(int index, KeyValuePair<string, string> value)
{ {
if (index > Count) Debug.Assert(index >= 0 && index <= Count);
{ Debug.Assert(value.Key != null);
throw new ArgumentOutOfRangeException();
}
if (_items == null) if (_items == null)
{ {
@ -130,10 +125,8 @@ namespace Microsoft.AspNet.Mvc.ViewFeatures
private void Insert(int index, KeyValuePair<string, string> value) private void Insert(int index, KeyValuePair<string, string> value)
{ {
if (index > Count) Debug.Assert(index >= 0 && index <= Count);
{ Debug.Assert(value.Key != null);
throw new ArgumentOutOfRangeException();
}
if (_items == null) if (_items == null)
{ {
@ -145,11 +138,7 @@ namespace Microsoft.AspNet.Mvc.ViewFeatures
private void Remove(int index) private void Remove(int index)
{ {
if (index >= Count) Debug.Assert(index >= 0 && index < Count);
{
throw new ArgumentOutOfRangeException();
}
_items.RemoveAt(index); _items.RemoveAt(index);
} }
@ -159,6 +148,8 @@ namespace Microsoft.AspNet.Mvc.ViewFeatures
// to do something with it. // to do something with it.
private int Find(string key) private int Find(string key)
{ {
Debug.Assert(key != null);
if (Count == 0) if (Count == 0)
{ {
return ~0; return ~0;