-Removed unused utility methods

-Fixed various code warnings
This commit is contained in:
JamesNK
2012-01-17 11:22:16 +00:00
parent 2941344044
commit 61db48c01d
29 changed files with 59 additions and 1131 deletions
@@ -65,7 +65,7 @@ namespace Newtonsoft.Json.Converters
return null;
}
if (reader.TokenType != JsonToken.StartConstructor || string.Compare(reader.Value.ToString(), "Date", StringComparison.Ordinal) != 0)
if (reader.TokenType != JsonToken.StartConstructor || !string.Equals(reader.Value.ToString(), "Date", StringComparison.Ordinal))
throw new Exception("Unexpected token or value when parsing date. Token: {0}, Value: {1}".FormatWith(CultureInfo.InvariantCulture, reader.TokenType, reader.Value));
reader.Read();
@@ -40,7 +40,7 @@ namespace Newtonsoft.Json.Converters
#if !SILVERLIGHT
internal class XmlDocumentWrapper : XmlNodeWrapper, IXmlDocument
{
private XmlDocument _document;
private readonly XmlDocument _document;
public XmlDocumentWrapper(XmlDocument document)
: base(document)
@@ -123,7 +123,7 @@ namespace Newtonsoft.Json.Converters
internal class XmlElementWrapper : XmlNodeWrapper, IXmlElement
{
private XmlElement _element;
private readonly XmlElement _element;
public XmlElementWrapper(XmlElement element)
: base(element)
@@ -146,7 +146,7 @@ namespace Newtonsoft.Json.Converters
internal class XmlDeclarationWrapper : XmlNodeWrapper, IXmlDeclaration
{
private XmlDeclaration _declaration;
private readonly XmlDeclaration _declaration;
public XmlDeclarationWrapper(XmlDeclaration declaration)
: base(declaration)
@@ -983,7 +983,7 @@ namespace Newtonsoft.Json.Converters
if (writePropertyName)
writer.WritePropertyName(GetPropertyName(node, manager));
if (ValueAttributes(node.Attributes).Count() == 0 && node.ChildNodes.Count == 1
if (!ValueAttributes(node.Attributes).Any() && node.ChildNodes.Count == 1
&& node.ChildNodes[0].NodeType == XmlNodeType.Text)
{
// write elements with a single text child as a name value pair
@@ -1319,11 +1319,11 @@ namespace Newtonsoft.Json.Converters
{
case JsonToken.PropertyName:
string attributeName = reader.Value.ToString();
string attributeValue;
if (!string.IsNullOrEmpty(attributeName))
{
char firstChar = attributeName[0];
string attributeValue;
switch (firstChar)
{