Prefer string.Equals static method over the Equals instance method

This commit is contained in:
Pranav K 2014-03-26 22:24:38 -07:00
parent cb21c34770
commit 44af396da9
3 changed files with 4 additions and 5 deletions

View File

@ -2,10 +2,9 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Reflection;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Reflection;
using Microsoft.AspNet.Mvc.ModelBinding.Internal;
using Newtonsoft.Json; using Newtonsoft.Json;
namespace Microsoft.AspNet.Mvc.ModelBinding namespace Microsoft.AspNet.Mvc.ModelBinding
@ -181,7 +180,7 @@ namespace Microsoft.AspNet.Mvc.ModelBinding
for (var i = 0; i < _supportedEncodings.Count; i++) for (var i = 0; i < _supportedEncodings.Count; i++)
{ {
var supportedEncoding = _supportedEncodings[i]; var supportedEncoding = _supportedEncodings[i];
if (charset.Equals(supportedEncoding.WebName, StringComparison.OrdinalIgnoreCase)) if (string.Equals(charset, supportedEncoding.WebName, StringComparison.OrdinalIgnoreCase))
{ {
return supportedEncoding; return supportedEncoding;
} }

View File

@ -27,7 +27,7 @@ namespace Microsoft.AspNet.Mvc.ModelBinding
public ValueProviderResult GetValue(string key) public ValueProviderResult GetValue(string key)
{ {
return String.Equals(key, Name, StringComparison.OrdinalIgnoreCase) return string.Equals(key, Name, StringComparison.OrdinalIgnoreCase)
? new ValueProviderResult(RawValue, Convert.ToString(RawValue, Culture), Culture) ? new ValueProviderResult(RawValue, Convert.ToString(RawValue, Culture), Culture)
: null; : null;
} }

View File

@ -27,7 +27,7 @@ namespace Microsoft.AspNet.Mvc.ModelBinding
{ {
var contentType = request.GetContentType(); var contentType = request.GetContentType();
return contentType != null && return contentType != null &&
contentType.ContentType.Equals(FormEncodedContentType, StringComparison.OrdinalIgnoreCase); string.Equals(contentType.ContentType, FormEncodedContentType, StringComparison.OrdinalIgnoreCase);
} }
private static CultureInfo GetCultureInfo(HttpRequest request) private static CultureInfo GetCultureInfo(HttpRequest request)