From 30322a49d267777a33b485f6808fe85a30fe0f7a Mon Sep 17 00:00:00 2001 From: JamesNK Date: Mon, 7 Dec 2009 22:39:10 +0000 Subject: [PATCH] -XML documentation -Fixed culture warnings --- Src/Newtonsoft.Json/Bson/BsonReader.cs | 50 ++++++++++++++----- Src/Newtonsoft.Json/Bson/BsonWriter.cs | 28 +++++++---- .../Converters/DataSetConverter.cs | 23 +++++++++ .../Converters/DataTableConverter.cs | 23 +++++++++ Src/Newtonsoft.Json/JsonReader.cs | 4 ++ Src/Newtonsoft.Json/JsonTextReader.cs | 6 +++ Src/Newtonsoft.Json/JsonTextWriter.cs | 4 ++ Src/Newtonsoft.Json/JsonValidatingReader.cs | 6 +++ Src/Newtonsoft.Json/JsonWriter.cs | 4 ++ Src/Newtonsoft.Json/Linq/JToken.cs | 31 ++++++++++++ Src/Newtonsoft.Json/Linq/JTokenReader.cs | 6 +++ Src/Newtonsoft.Json/Linq/JTokenType.cs | 8 ++- Src/Newtonsoft.Json/Linq/JTokenWriter.cs | 4 ++ Src/Newtonsoft.Json/Required.cs | 12 +++++ .../Serialization/DynamicValueProvider.cs | 44 +++++++++++++++- .../Serialization/IValueProvider.cs | 42 ++++++++++++++-- .../Serialization/JsonContract.cs | 9 ++++ .../Serialization/JsonProperty.cs | 9 +++- .../Serialization/JsonPropertyCollection.cs | 4 ++ .../Serialization/ReflectionValueProvider.cs | 44 +++++++++++++++- .../Utilities/DynamicWrapper.cs | 6 +-- 21 files changed, 330 insertions(+), 37 deletions(-) diff --git a/Src/Newtonsoft.Json/Bson/BsonReader.cs b/Src/Newtonsoft.Json/Bson/BsonReader.cs index 2c068eb2..225d0fa8 100644 --- a/Src/Newtonsoft.Json/Bson/BsonReader.cs +++ b/Src/Newtonsoft.Json/Bson/BsonReader.cs @@ -34,19 +34,9 @@ using Newtonsoft.Json.Linq; namespace Newtonsoft.Json.Bson { - internal enum BsonReaderState - { - Normal, - ReferenceStart, - ReferenceRef, - ReferenceId, - CodeWScopeStart, - CodeWScopeCode, - CodeWScopeScope, - CodeWScopeScopeObject, - CodeWScopeScopeEnd - } - + /// + /// Represents a reader that provides fast, non-cached, forward-only access to serialized Json data. + /// public class BsonReader : JsonReader { private readonly BinaryReader _reader; @@ -56,6 +46,19 @@ namespace Newtonsoft.Json.Bson private BsonType _currentElementType; private BsonReaderState _bsonReaderState; + private enum BsonReaderState + { + Normal, + ReferenceStart, + ReferenceRef, + ReferenceId, + CodeWScopeStart, + CodeWScopeCode, + CodeWScopeScope, + CodeWScopeScopeObject, + CodeWScopeScopeEnd + } + private class ContainerContext { public JTokenType Type { get; private set; } @@ -79,10 +82,19 @@ namespace Newtonsoft.Json.Bson } } + /// + /// Initializes a new instance of the class. + /// + /// The stream. public BsonReader(Stream stream) : this(stream, false) { } + /// + /// Initializes a new instance of the class. + /// + /// The stream. + /// if set to true the root object will be read as a JSON array. public BsonReader(Stream stream, bool rootTypeIsArray) { ValidationUtils.ArgumentNotNull(stream, "stream"); @@ -98,6 +110,12 @@ namespace Newtonsoft.Json.Bson return elementName; } + /// + /// Reads the next JSON token from the stream as a . + /// + /// + /// A or a null reference if the next JSON token is null. + /// public override byte[] ReadAsBytes() { Read(); @@ -107,6 +125,12 @@ namespace Newtonsoft.Json.Bson return (byte[])Value; } + /// + /// Reads the next JSON token from the stream. + /// + /// + /// true if the next token was read successfully; false if there are no more tokens to read. + /// public override bool Read() { try diff --git a/Src/Newtonsoft.Json/Bson/BsonWriter.cs b/Src/Newtonsoft.Json/Bson/BsonWriter.cs index 755b135a..507fea14 100644 --- a/Src/Newtonsoft.Json/Bson/BsonWriter.cs +++ b/Src/Newtonsoft.Json/Bson/BsonWriter.cs @@ -24,28 +24,34 @@ #endregion using System; -using System.Collections.Generic; using System.IO; -using System.Linq; using System.Text; using Newtonsoft.Json.Utilities; using Newtonsoft.Json.Linq; +using System.Globalization; namespace Newtonsoft.Json.Bson { + /// + /// Represents a writer that provides a fast, non-cached, forward-only way of generating Json data. + /// public class BsonWriter : JTokenWriter { - private readonly Stream _stream; private readonly BinaryWriter _writer; - + /// + /// Initializes a new instance of the class. + /// + /// The stream. public BsonWriter(Stream stream) { ValidationUtils.ArgumentNotNull(stream, "stream"); - _stream = stream; _writer = new BinaryWriter(stream); } + /// + /// Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. + /// public override void Flush() { _writer.Flush(); @@ -76,7 +82,7 @@ namespace Newtonsoft.Json.Bson foreach (JToken c in t) { _writer.Write((sbyte)GetTypeNumber(c)); - WriteString(index.ToString()); + WriteString(index.ToString(CultureInfo.InvariantCulture)); WriteToken(c); index++; } @@ -84,10 +90,10 @@ namespace Newtonsoft.Json.Bson } break; case JTokenType.Integer: - _writer.Write(Convert.ToInt32(((JValue)t).Value)); + _writer.Write(Convert.ToInt32(((JValue)t).Value, CultureInfo.InvariantCulture)); break; case JTokenType.Float: - _writer.Write(Convert.ToDouble(((JValue)t).Value)); + _writer.Write(Convert.ToDouble(((JValue)t).Value, CultureInfo.InvariantCulture)); break; case JTokenType.String: WriteStringWithLength((string)t); @@ -201,7 +207,7 @@ namespace Newtonsoft.Json.Bson foreach (JToken c in t) { bases += 1; - bases += CalculateSize(index.ToString()); + bases += CalculateSize(index.ToString(CultureInfo.InvariantCulture)); bases += CalculateSize(c); index++; } @@ -243,6 +249,10 @@ namespace Newtonsoft.Json.Bson } } + /// + /// Writes the end. + /// + /// The token. protected override void WriteEnd(JsonToken token) { base.WriteEnd(token); diff --git a/Src/Newtonsoft.Json/Converters/DataSetConverter.cs b/Src/Newtonsoft.Json/Converters/DataSetConverter.cs index 6fe951a1..89b4833c 100644 --- a/Src/Newtonsoft.Json/Converters/DataSetConverter.cs +++ b/Src/Newtonsoft.Json/Converters/DataSetConverter.cs @@ -32,8 +32,17 @@ using System.Text; namespace Newtonsoft.Json.Converters { + /// + /// Converts a to and from JSON. + /// public class DataSetConverter : JsonConverter { + /// + /// Writes the JSON representation of the object. + /// + /// The to write to. + /// The value. + /// The calling serializer. public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) { DataSet dataSet = (DataSet)value; @@ -52,6 +61,13 @@ namespace Newtonsoft.Json.Converters writer.WriteEndObject(); } + /// + /// Reads the JSON representation of the object. + /// + /// The to read from. + /// Type of the object. + /// The calling serializer. + /// The object value. public override object ReadJson(JsonReader reader, Type objectType, JsonSerializer serializer) { DataSet ds = new DataSet(); @@ -71,6 +87,13 @@ namespace Newtonsoft.Json.Converters return ds; } + /// + /// Determines whether this instance can convert the specified value type. + /// + /// Type of the value. + /// + /// true if this instance can convert the specified value type; otherwise, false. + /// public override bool CanConvert(Type valueType) { return (valueType == typeof(DataSet)); diff --git a/Src/Newtonsoft.Json/Converters/DataTableConverter.cs b/Src/Newtonsoft.Json/Converters/DataTableConverter.cs index e207f8a4..7c04c55a 100644 --- a/Src/Newtonsoft.Json/Converters/DataTableConverter.cs +++ b/Src/Newtonsoft.Json/Converters/DataTableConverter.cs @@ -32,8 +32,17 @@ using System.Data; namespace Newtonsoft.Json.Converters { + /// + /// Converts a to and from JSON. + /// public class DataTableConverter : JsonConverter { + /// + /// Writes the JSON representation of the object. + /// + /// The to write to. + /// The value. + /// The calling serializer. public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) { DataTable table = (DataTable)value; @@ -54,6 +63,13 @@ namespace Newtonsoft.Json.Converters writer.WriteEndArray(); } + /// + /// Reads the JSON representation of the object. + /// + /// The to read from. + /// Type of the object. + /// The calling serializer. + /// The object value. public override object ReadJson(JsonReader reader, Type objectType, JsonSerializer serializer) { DataTable dt; @@ -123,6 +139,13 @@ namespace Newtonsoft.Json.Converters } } + /// + /// Determines whether this instance can convert the specified value type. + /// + /// Type of the value. + /// + /// true if this instance can convert the specified value type; otherwise, false. + /// public override bool CanConvert(Type valueType) { return (valueType == typeof(DataTable)); diff --git a/Src/Newtonsoft.Json/JsonReader.cs b/Src/Newtonsoft.Json/JsonReader.cs index 875a5ac9..c6a3b762 100644 --- a/Src/Newtonsoft.Json/JsonReader.cs +++ b/Src/Newtonsoft.Json/JsonReader.cs @@ -204,6 +204,10 @@ namespace Newtonsoft.Json /// true if the next token was read successfully; false if there are no more tokens to read. public abstract bool Read(); + /// + /// Reads the next JSON token from the stream as a . + /// + /// A or a null reference if the next JSON token is null. public abstract byte[] ReadAsBytes(); /// diff --git a/Src/Newtonsoft.Json/JsonTextReader.cs b/Src/Newtonsoft.Json/JsonTextReader.cs index 00ce3f6d..373049d5 100644 --- a/Src/Newtonsoft.Json/JsonTextReader.cs +++ b/Src/Newtonsoft.Json/JsonTextReader.cs @@ -327,6 +327,12 @@ namespace Newtonsoft.Json } } + /// + /// Reads the next JSON token from the stream as a . + /// + /// + /// A or a null reference if the next JSON token is null. + /// public override byte[] ReadAsBytes() { while (true) diff --git a/Src/Newtonsoft.Json/JsonTextWriter.cs b/Src/Newtonsoft.Json/JsonTextWriter.cs index ce2ee004..df444f76 100644 --- a/Src/Newtonsoft.Json/JsonTextWriter.cs +++ b/Src/Newtonsoft.Json/JsonTextWriter.cs @@ -431,6 +431,10 @@ namespace Newtonsoft.Json WriteValueInternal(JsonConvert.ToString(value), JsonToken.Date); } + /// + /// Writes a value. + /// + /// The value to write. public override void WriteValue(byte[] value) { base.WriteValue(value); diff --git a/Src/Newtonsoft.Json/JsonValidatingReader.cs b/Src/Newtonsoft.Json/JsonValidatingReader.cs index 2b958aa0..3498bbd1 100644 --- a/Src/Newtonsoft.Json/JsonValidatingReader.cs +++ b/Src/Newtonsoft.Json/JsonValidatingReader.cs @@ -304,6 +304,12 @@ namespace Newtonsoft.Json } } + /// + /// Reads the next JSON token from the stream as a . + /// + /// + /// A or a null reference if the next JSON token is null. + /// public override byte[] ReadAsBytes() { byte[] data = _reader.ReadAsBytes(); diff --git a/Src/Newtonsoft.Json/JsonWriter.cs b/Src/Newtonsoft.Json/JsonWriter.cs index eeabf6fe..09d2ec5e 100644 --- a/Src/Newtonsoft.Json/JsonWriter.cs +++ b/Src/Newtonsoft.Json/JsonWriter.cs @@ -975,6 +975,10 @@ namespace Newtonsoft.Json } #endif + /// + /// Writes a value. + /// + /// The value to write. public virtual void WriteValue(byte[] value) { if (value == null) diff --git a/Src/Newtonsoft.Json/Linq/JToken.cs b/Src/Newtonsoft.Json/Linq/JToken.cs index 8587e5ed..d9d50e33 100644 --- a/Src/Newtonsoft.Json/Linq/JToken.cs +++ b/Src/Newtonsoft.Json/Linq/JToken.cs @@ -742,6 +742,11 @@ namespace Newtonsoft.Json.Linq return Convert.ToUInt64(v.Value, CultureInfo.InvariantCulture); } + /// + /// Performs an explicit conversion from to . + /// + /// The value. + /// The result of the conversion. public static explicit operator byte[](JToken value) { JValue v = EnsureValue(value); @@ -987,6 +992,11 @@ namespace Newtonsoft.Json.Linq return new JValue(value); } + /// + /// Performs an implicit conversion from to . + /// + /// The value to create a from. + /// The initialized with the specified value. public static implicit operator JToken(byte[] value) { return new JValue(value); @@ -1123,11 +1133,32 @@ namespace Newtonsoft.Json.Linq get { return _linePosition ?? 0; } } + /// + /// Selects the token that matches the object path. + /// + /// + /// The object path from the current to the + /// to be returned. This must be a string of property names or array indexes separated + /// by periods, such as Tables[0].DefaultView[0].Price in C# or + /// Tables(0).DefaultView(0).Price in Visual Basic. + /// + /// The that matches the object path or a null reference if no matching token is found. public JToken SelectToken(string path) { return SelectToken(path, false); } + /// + /// Selects the token that matches the object path. + /// + /// + /// The object path from the current to the + /// to be returned. This must be a string of property names or array indexes separated + /// by periods, such as Tables[0].DefaultView[0].Price in C# or + /// Tables(0).DefaultView(0).Price in Visual Basic. + /// + /// A flag to indicate whether an error should be thrown if no token is found. + /// The that matches the object path. public JToken SelectToken(string path, bool errorWhenNoMatch) { JPath p = new JPath(path); diff --git a/Src/Newtonsoft.Json/Linq/JTokenReader.cs b/Src/Newtonsoft.Json/Linq/JTokenReader.cs index dc220420..011ec158 100644 --- a/Src/Newtonsoft.Json/Linq/JTokenReader.cs +++ b/Src/Newtonsoft.Json/Linq/JTokenReader.cs @@ -28,6 +28,12 @@ namespace Newtonsoft.Json.Linq _current = token; } + /// + /// Reads the next JSON token from the stream as a . + /// + /// + /// A or a null reference if the next JSON token is null. + /// public override byte[] ReadAsBytes() { Read(); diff --git a/Src/Newtonsoft.Json/Linq/JTokenType.cs b/Src/Newtonsoft.Json/Linq/JTokenType.cs index e20ce277..dafb7e12 100644 --- a/Src/Newtonsoft.Json/Linq/JTokenType.cs +++ b/Src/Newtonsoft.Json/Linq/JTokenType.cs @@ -23,11 +23,6 @@ // OTHER DEALINGS IN THE SOFTWARE. #endregion -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - namespace Newtonsoft.Json.Linq { /// @@ -91,6 +86,9 @@ namespace Newtonsoft.Json.Linq /// A raw JSON value. /// Raw, + /// + /// A collection of bytes value. + /// Bytes } } \ No newline at end of file diff --git a/Src/Newtonsoft.Json/Linq/JTokenWriter.cs b/Src/Newtonsoft.Json/Linq/JTokenWriter.cs index baae1ed1..d9413a39 100644 --- a/Src/Newtonsoft.Json/Linq/JTokenWriter.cs +++ b/Src/Newtonsoft.Json/Linq/JTokenWriter.cs @@ -346,6 +346,10 @@ namespace Newtonsoft.Json.Linq } #endif + /// + /// Writes a value. + /// + /// The value to write. public override void WriteValue(byte[] value) { base.WriteValue(value); diff --git a/Src/Newtonsoft.Json/Required.cs b/Src/Newtonsoft.Json/Required.cs index 5777a7c7..b48ba411 100644 --- a/Src/Newtonsoft.Json/Required.cs +++ b/Src/Newtonsoft.Json/Required.cs @@ -1,9 +1,21 @@ namespace Newtonsoft.Json { + /// + /// Indicating whether a property is required. + /// public enum Required { + /// + /// The property is not required. The default state. + /// Default, + /// + /// The property must be defined in JSON but can be a null value. + /// AllowNull, + /// + /// The property must be defined in JSON and cannot be a null value. + /// Always } } \ No newline at end of file diff --git a/Src/Newtonsoft.Json/Serialization/DynamicValueProvider.cs b/Src/Newtonsoft.Json/Serialization/DynamicValueProvider.cs index 4b3b5673..d0ad41cb 100644 --- a/Src/Newtonsoft.Json/Serialization/DynamicValueProvider.cs +++ b/Src/Newtonsoft.Json/Serialization/DynamicValueProvider.cs @@ -1,4 +1,29 @@ -#if !PocketPC +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +#if !PocketPC using System; using System.Collections.Generic; using System.Linq; @@ -9,18 +34,30 @@ using System.Globalization; namespace Newtonsoft.Json.Serialization { + /// + /// Get and set values for a using dynamic methods. + /// public class DynamicValueProvider : IValueProvider { private readonly MemberInfo _memberInfo; private Func _getter; private Action _setter; + /// + /// Initializes a new instance of the class. + /// + /// The member info. public DynamicValueProvider(MemberInfo memberInfo) { ValidationUtils.ArgumentNotNull(memberInfo, "memberInfo"); _memberInfo = memberInfo; } + /// + /// Sets the value. + /// + /// The target to set the value on. + /// The value to set on the target. public void SetValue(object target, object value) { try @@ -36,6 +73,11 @@ namespace Newtonsoft.Json.Serialization } } + /// + /// Gets the value. + /// + /// The target to get the value from. + /// The value. public object GetValue(object target) { try diff --git a/Src/Newtonsoft.Json/Serialization/IValueProvider.cs b/Src/Newtonsoft.Json/Serialization/IValueProvider.cs index 26278982..78fbe513 100644 --- a/Src/Newtonsoft.Json/Serialization/IValueProvider.cs +++ b/Src/Newtonsoft.Json/Serialization/IValueProvider.cs @@ -1,13 +1,47 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion namespace Newtonsoft.Json.Serialization { + /// + /// Provides methods to get and set values. + /// public interface IValueProvider { + /// + /// Sets the value. + /// + /// The target to set the value on. + /// The value to set on the target. void SetValue(object target, object value); + + /// + /// Gets the value. + /// + /// The target to get the value from. + /// The value. object GetValue(object target); } } \ No newline at end of file diff --git a/Src/Newtonsoft.Json/Serialization/JsonContract.cs b/Src/Newtonsoft.Json/Serialization/JsonContract.cs index 6d819481..4b78a7ca 100644 --- a/Src/Newtonsoft.Json/Serialization/JsonContract.cs +++ b/Src/Newtonsoft.Json/Serialization/JsonContract.cs @@ -79,7 +79,16 @@ namespace Newtonsoft.Json.Serialization public MethodInfo OnSerializing { get; set; } #endif + /// + /// Gets or sets the default creator. + /// + /// The default creator. public Func DefaultCreator { get; set; } + + /// + /// Gets or sets a value indicating whether [default creator non public]. + /// + /// true if the default object creator is non-public; otherwise, false. public bool DefaultCreatorNonPublic { get; set; } /// diff --git a/Src/Newtonsoft.Json/Serialization/JsonProperty.cs b/Src/Newtonsoft.Json/Serialization/JsonProperty.cs index 0d57d3b8..43ee5079 100644 --- a/Src/Newtonsoft.Json/Serialization/JsonProperty.cs +++ b/Src/Newtonsoft.Json/Serialization/JsonProperty.cs @@ -23,7 +23,6 @@ // OTHER DEALINGS IN THE SOFTWARE. #endregion -using System.Reflection; using System; namespace Newtonsoft.Json.Serialization @@ -45,8 +44,16 @@ namespace Newtonsoft.Json.Serialization /// The that will get and set the during serialization. public IValueProvider ValueProvider { get; set; } + /// + /// Gets or sets the type of the property. + /// + /// The type of the property. public Type PropertyType { get; set; } + /// + /// Gets or sets the converter. + /// + /// The converter. public JsonConverter Converter { get; set; } /// diff --git a/Src/Newtonsoft.Json/Serialization/JsonPropertyCollection.cs b/Src/Newtonsoft.Json/Serialization/JsonPropertyCollection.cs index 5178eef0..2a3aeaba 100644 --- a/Src/Newtonsoft.Json/Serialization/JsonPropertyCollection.cs +++ b/Src/Newtonsoft.Json/Serialization/JsonPropertyCollection.cs @@ -39,6 +39,10 @@ namespace Newtonsoft.Json.Serialization { private readonly JsonObjectContract _contract; + /// + /// Initializes a new instance of the class. + /// + /// The contract. public JsonPropertyCollection(JsonObjectContract contract) { ValidationUtils.ArgumentNotNull(contract, "contract"); diff --git a/Src/Newtonsoft.Json/Serialization/ReflectionValueProvider.cs b/Src/Newtonsoft.Json/Serialization/ReflectionValueProvider.cs index 61c323c2..4013cf36 100644 --- a/Src/Newtonsoft.Json/Serialization/ReflectionValueProvider.cs +++ b/Src/Newtonsoft.Json/Serialization/ReflectionValueProvider.cs @@ -1,4 +1,29 @@ -using System; +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -8,16 +33,28 @@ using System.Globalization; namespace Newtonsoft.Json.Serialization { + /// + /// Get and set values for a using reflection. + /// public class ReflectionValueProvider : IValueProvider { private readonly MemberInfo _memberInfo; + /// + /// Initializes a new instance of the class. + /// + /// The member info. public ReflectionValueProvider(MemberInfo memberInfo) { ValidationUtils.ArgumentNotNull(memberInfo, "memberInfo"); _memberInfo = memberInfo; } + /// + /// Sets the value. + /// + /// The target to set the value on. + /// The value to set on the target. public void SetValue(object target, object value) { try @@ -30,6 +67,11 @@ namespace Newtonsoft.Json.Serialization } } + /// + /// Gets the value. + /// + /// The target to get the value from. + /// The value. public object GetValue(object target) { try diff --git a/Src/Newtonsoft.Json/Utilities/DynamicWrapper.cs b/Src/Newtonsoft.Json/Utilities/DynamicWrapper.cs index cb5bf2b7..6c80c652 100644 --- a/Src/Newtonsoft.Json/Utilities/DynamicWrapper.cs +++ b/Src/Newtonsoft.Json/Utilities/DynamicWrapper.cs @@ -12,12 +12,12 @@ using System.Globalization; namespace Newtonsoft.Json.Utilities { - public class DynamicWrapperBase + internal class DynamicWrapperBase { internal protected object UnderlyingObject; } - public static class DynamicWrapper + internal static class DynamicWrapper { private static readonly object _lock = new object(); private static readonly WrapperDictionary _wrapperDictionary = new WrapperDictionary(); @@ -224,7 +224,7 @@ namespace Newtonsoft.Json.Utilities } } - public static class TypeExtensions + internal static class TypeExtensions { public static MethodInfo GetGenericMethod(this Type type, string name, params Type[] parameterTypes) {