CR feedback from 9fded74b15

This commit is contained in:
Ryan Nowak 2015-04-28 14:15:33 -07:00
parent 584015c79b
commit 38bd617778
11 changed files with 10 additions and 20 deletions

View File

@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNet.Mvc.ModelBinding.Internal;
namespace Microsoft.AspNet.Mvc.ModelBinding namespace Microsoft.AspNet.Mvc.ModelBinding
{ {

View File

@ -4,7 +4,6 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNet.Mvc.ModelBinding.Internal;
using Microsoft.Framework.Internal; using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Mvc.ModelBinding namespace Microsoft.AspNet.Mvc.ModelBinding

View File

@ -4,7 +4,6 @@
using System; using System;
using System.Globalization; using System.Globalization;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNet.Mvc.ModelBinding.Internal;
namespace Microsoft.AspNet.Mvc.ModelBinding namespace Microsoft.AspNet.Mvc.ModelBinding
{ {

View File

@ -7,7 +7,6 @@ using System.Linq;
using System.Reflection; using System.Reflection;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNet.Http; using Microsoft.AspNet.Http;
using Microsoft.AspNet.Mvc.ModelBinding.Internal;
using Microsoft.Framework.Internal; using Microsoft.Framework.Internal;
using Microsoft.Net.Http.Headers; using Microsoft.Net.Http.Headers;

View File

@ -6,7 +6,6 @@ using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.Reflection; using System.Reflection;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNet.Mvc.ModelBinding.Internal;
namespace Microsoft.AspNet.Mvc.ModelBinding namespace Microsoft.AspNet.Mvc.ModelBinding
{ {

View File

@ -4,7 +4,6 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Reflection; using System.Reflection;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNet.Mvc.ModelBinding.Internal;
using Microsoft.Framework.Internal; using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Mvc.ModelBinding namespace Microsoft.AspNet.Mvc.ModelBinding

View File

@ -6,7 +6,7 @@ using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using Microsoft.Framework.Internal; using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Mvc.ModelBinding.Internal namespace Microsoft.AspNet.Mvc.ModelBinding
{ {
/// <summary> /// <summary>
/// This is a container for prefix values. It normalizes all the values into dotted-form and then stores /// This is a container for prefix values. It normalizes all the values into dotted-form and then stores
@ -18,14 +18,14 @@ namespace Microsoft.AspNet.Mvc.ModelBinding.Internal
private readonly ICollection<string> _originalValues; private readonly ICollection<string> _originalValues;
private readonly string[] _sortedValues; private readonly string[] _sortedValues;
internal PrefixContainer([NotNull] ICollection<string> values) public PrefixContainer([NotNull] ICollection<string> values)
{ {
_originalValues = values; _originalValues = values;
_sortedValues = ToArrayWithoutNulls(_originalValues); _sortedValues = ToArrayWithoutNulls(_originalValues);
Array.Sort(_sortedValues, StringComparer.OrdinalIgnoreCase); Array.Sort(_sortedValues, StringComparer.OrdinalIgnoreCase);
} }
internal bool ContainsPrefix([NotNull] string prefix) public bool ContainsPrefix([NotNull] string prefix)
{ {
if (prefix.Length == 0) if (prefix.Length == 0)
{ {
@ -51,7 +51,7 @@ namespace Microsoft.AspNet.Mvc.ModelBinding.Internal
// - "bar"/"foo.bar" // - "bar"/"foo.bar"
// - "hello"/"foo.hello" // - "hello"/"foo.hello"
// - "abc"/"foo[abc]" // - "abc"/"foo[abc]"
internal IDictionary<string, string> GetKeysFromPrefix(string prefix) public IDictionary<string, string> GetKeysFromPrefix(string prefix)
{ {
var result = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); var result = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
@ -149,7 +149,7 @@ namespace Microsoft.AspNet.Mvc.ModelBinding.Internal
} }
} }
internal static bool IsPrefixMatch(string prefix, string testString) public static bool IsPrefixMatch(string prefix, string testString)
{ {
if (testString == null) if (testString == null)
{ {
@ -192,13 +192,13 @@ namespace Microsoft.AspNet.Mvc.ModelBinding.Internal
/// Convert an ICollection to an array, removing null values. Fast path for case where /// Convert an ICollection to an array, removing null values. Fast path for case where
/// there are no null values. /// there are no null values.
/// </summary> /// </summary>
private static T[] ToArrayWithoutNulls<T>(ICollection<T> collection) where T : class private static TElement[] ToArrayWithoutNulls<TElement>(ICollection<TElement> collection) where TElement : class
{ {
Debug.Assert(collection != null); Debug.Assert(collection != null);
var result = new T[collection.Count]; var result = new TElement[collection.Count];
var count = 0; var count = 0;
foreach (T value in collection) foreach (TElement value in collection)
{ {
if (value != null) if (value != null)
{ {
@ -212,13 +212,13 @@ namespace Microsoft.AspNet.Mvc.ModelBinding.Internal
} }
else else
{ {
var trimmedResult = new T[count]; var trimmedResult = new TElement[count];
Array.Copy(result, trimmedResult, count); Array.Copy(result, trimmedResult, count);
return trimmedResult; return trimmedResult;
} }
} }
private sealed class PrefixComparer : IComparer<String> private sealed class PrefixComparer : IComparer<string>
{ {
private readonly string _prefix; private readonly string _prefix;

View File

@ -7,7 +7,6 @@ using System.Diagnostics;
using System.Globalization; using System.Globalization;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNet.Http; using Microsoft.AspNet.Http;
using Microsoft.AspNet.Mvc.ModelBinding.Internal;
using Microsoft.Framework.Internal; using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Mvc.ModelBinding namespace Microsoft.AspNet.Mvc.ModelBinding

View File

@ -3,7 +3,6 @@
using System; using System;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNet.Mvc.ModelBinding.Internal;
namespace Microsoft.AspNet.Mvc.ModelBinding namespace Microsoft.AspNet.Mvc.ModelBinding
{ {

View File

@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNet.Mvc.ModelBinding.Internal;
namespace Microsoft.AspNet.Mvc.ModelBinding namespace Microsoft.AspNet.Mvc.ModelBinding
{ {

View File

@ -7,7 +7,6 @@ using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.Linq; using System.Linq;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using Microsoft.AspNet.Mvc.ModelBinding.Internal;
using Microsoft.Framework.Internal; using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Mvc.ModelBinding.Validation namespace Microsoft.AspNet.Mvc.ModelBinding.Validation