diff --git a/Src/Newtonsoft.Json/JsonContainerAttribute.cs b/Src/Newtonsoft.Json/JsonContainerAttribute.cs
index bf894657..1ca25541 100644
--- a/Src/Newtonsoft.Json/JsonContainerAttribute.cs
+++ b/Src/Newtonsoft.Json/JsonContainerAttribute.cs
@@ -59,9 +59,9 @@ namespace Newtonsoft.Json
public Type ItemConverterType { get; set; }
///
- /// The parameter list to use when constructing the JsonConverter described by ItemConverterType.
+ /// The parameter list to use when constructing the described by ItemConverterType.
/// If null, the default constructor is used.
- /// When non-null, there must be a constructor defined in the JsonConverter that exactly matches the number,
+ /// When non-null, there must be a constructor defined in the that exactly matches the number,
/// order, and type of these parameters.
///
///
@@ -69,6 +69,10 @@ namespace Newtonsoft.Json
///
public object[] ItemConverterParameters { get; set; }
+ ///
+ /// Gets the of the .
+ ///
+ /// The of the .
public Type NamingStrategyType
{
get { return _namingStrategyType; }
@@ -79,6 +83,15 @@ namespace Newtonsoft.Json
}
}
+ ///
+ /// The parameter list to use when constructing the described by NamingStrategyType.
+ /// If null, the default constructor is used.
+ /// When non-null, there must be a constructor defined in the that exactly matches the number,
+ /// order, and type of these parameters.
+ ///
+ ///
+ /// [JsonContainer(NamingStrategyType = typeof(MyNamingStrategy), NamingStrategyParameters = new object[] { 123, "Four" })]
+ ///
public object[] NamingStrategyParameters
{
get { return _namingStrategyParameters; }
diff --git a/Src/Newtonsoft.Json/JsonConverterAttribute.cs b/Src/Newtonsoft.Json/JsonConverterAttribute.cs
index fdafb3a4..aea831f6 100644
--- a/Src/Newtonsoft.Json/JsonConverterAttribute.cs
+++ b/Src/Newtonsoft.Json/JsonConverterAttribute.cs
@@ -38,16 +38,16 @@ namespace Newtonsoft.Json
private readonly Type _converterType;
///
- /// Gets the of the converter.
+ /// Gets the of the .
///
- /// The of the converter.
+ /// The of the .
public Type ConverterType
{
get { return _converterType; }
}
///
- /// The parameter list to use when constructing the JsonConverter described by ConverterType.
+ /// The parameter list to use when constructing the described by ConverterType.
/// If null, the default constructor is used.
///
public object[] ConverterParameters { get; private set; }
@@ -55,7 +55,7 @@ namespace Newtonsoft.Json
///
/// Initializes a new instance of the class.
///
- /// Type of the converter.
+ /// Type of the .
public JsonConverterAttribute(Type converterType)
{
if (converterType == null)
@@ -69,8 +69,8 @@ namespace Newtonsoft.Json
///
/// Initializes a new instance of the class.
///
- /// Type of the converter.
- /// Parameter list to use when constructing the JsonConverter. Can be null.
+ /// Type of the .
+ /// Parameter list to use when constructing the . Can be null.
public JsonConverterAttribute(Type converterType, params object[] converterParameters)
: this(converterType)
{
diff --git a/Src/Newtonsoft.Json/JsonPropertyAttribute.cs b/Src/Newtonsoft.Json/JsonPropertyAttribute.cs
index 211bd842..b2a38ffa 100644
--- a/Src/Newtonsoft.Json/JsonPropertyAttribute.cs
+++ b/Src/Newtonsoft.Json/JsonPropertyAttribute.cs
@@ -24,6 +24,7 @@
#endregion
using System;
+using Newtonsoft.Json.Serialization;
namespace Newtonsoft.Json
{
@@ -48,15 +49,15 @@ namespace Newtonsoft.Json
internal TypeNameHandling? _itemTypeNameHandling;
///
- /// Gets or sets the converter used when serializing the property's collection items.
+ /// Gets or sets the used when serializing the property's collection items.
///
- /// The collection's items converter.
+ /// The collection's items .
public Type ItemConverterType { get; set; }
///
- /// The parameter list to use when constructing the JsonConverter described by ItemConverterType.
+ /// The parameter list to use when constructing the described by ItemConverterType.
/// If null, the default constructor is used.
- /// When non-null, there must be a constructor defined in the JsonConverter that exactly matches the number,
+ /// When non-null, there must be a constructor defined in the that exactly matches the number,
/// order, and type of these parameters.
///
///
@@ -64,7 +65,21 @@ namespace Newtonsoft.Json
///
public object[] ItemConverterParameters { get; set; }
+ ///
+ /// Gets the of the .
+ ///
+ /// The of the .
public Type NamingStrategyType { get; set; }
+
+ ///
+ /// The parameter list to use when constructing the described by NamingStrategyType.
+ /// If null, the default constructor is used.
+ /// When non-null, there must be a constructor defined in the that exactly matches the number,
+ /// order, and type of these parameters.
+ ///
+ ///
+ /// [JsonProperty(NamingStrategyType = typeof(MyNamingStrategy), NamingStrategyParameters = new object[] { 123, "Four" })]
+ ///
public object[] NamingStrategyParameters { get; set; }
///
diff --git a/Src/Newtonsoft.Json/Serialization/CamelCaseNamingStrategy.cs b/Src/Newtonsoft.Json/Serialization/CamelCaseNamingStrategy.cs
index a2d8a8c8..9a665b76 100644
--- a/Src/Newtonsoft.Json/Serialization/CamelCaseNamingStrategy.cs
+++ b/Src/Newtonsoft.Json/Serialization/CamelCaseNamingStrategy.cs
@@ -2,21 +2,53 @@
namespace Newtonsoft.Json.Serialization
{
+ ///
+ /// A camel case naming strategy.
+ ///
public class CamelCaseNamingStrategy : INamingStrategy
{
+ ///
+ /// A flag indicating whether dictionary keys should be camel cased.
+ /// Defaults to false.
+ ///
public bool CamelCaseDictionaryKeys { get; set; }
+
+ ///
+ /// A flag indicating whether explicitly specified property names,
+ /// e.g. a property name customized with a , should be camel cased.
+ /// Defaults to false.
+ ///
public bool OverrideSpecifiedNames { get; set; }
- public CamelCaseNamingStrategy()
- {
- }
-
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ ///
+ /// A flag indicating whether dictionary keys should be camel cased.
+ ///
+ ///
+ /// A flag indicating whether explicitly specified property names,
+ /// e.g. a property name customized with a , should be camel cased.
+ ///
public CamelCaseNamingStrategy(bool camelCaseDictionaryKeys, bool overrideSpecifiedNames)
{
CamelCaseDictionaryKeys = camelCaseDictionaryKeys;
OverrideSpecifiedNames = overrideSpecifiedNames;
}
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public CamelCaseNamingStrategy()
+ {
+ }
+
+ ///
+ /// Gets the serialized name for a given property name.
+ ///
+ /// The initial property name.
+ /// A flag indicating whether the property has had a name explicitly specfied.
+ /// A property name.
public string GetPropertyName(string s, bool hasSpecifiedName)
{
if (hasSpecifiedName && !OverrideSpecifiedNames)
@@ -27,6 +59,11 @@ namespace Newtonsoft.Json.Serialization
return StringUtils.ToCamelCase(s);
}
+ ///
+ /// Gets the serialized key for a given dictionary key.
+ ///
+ /// The initial dictionary key.
+ /// A dictionary key.
public string GetDictionaryKey(string s)
{
if (!CamelCaseDictionaryKeys)
diff --git a/Src/Newtonsoft.Json/Serialization/DefaultContractResolver.cs b/Src/Newtonsoft.Json/Serialization/DefaultContractResolver.cs
index 199f925b..e42ee67b 100644
--- a/Src/Newtonsoft.Json/Serialization/DefaultContractResolver.cs
+++ b/Src/Newtonsoft.Json/Serialization/DefaultContractResolver.cs
@@ -184,6 +184,10 @@ namespace Newtonsoft.Json.Serialization
public bool IgnoreSerializableAttribute { get; set; }
#endif
+ ///
+ /// Gets or sets the naming strategy used to resolve how property names and dictionary keys are serialized.
+ ///
+ /// The naming strategy used to resolve how property names and dictionary keys are serialized.
public INamingStrategy NamingStrategy { get; set; }
///
diff --git a/Src/Newtonsoft.Json/Serialization/DefaultNamingStrategy.cs b/Src/Newtonsoft.Json/Serialization/DefaultNamingStrategy.cs
index 2ddec384..c8f6ef2a 100644
--- a/Src/Newtonsoft.Json/Serialization/DefaultNamingStrategy.cs
+++ b/Src/Newtonsoft.Json/Serialization/DefaultNamingStrategy.cs
@@ -1,12 +1,26 @@
namespace Newtonsoft.Json.Serialization
{
+ ///
+ /// The default naming strategy. Property names and dictionary keys are unchanged.
+ ///
public class DefaultNamingStrategy : INamingStrategy
{
+ ///
+ /// Gets the serialized name for a given property name.
+ ///
+ /// The initial property name.
+ /// A flag indicating whether the property has had a name explicitly specfied.
+ /// A property name.
public string GetPropertyName(string s, bool hasSpecifiedName)
{
return s;
}
+ ///
+ /// Gets the serialized key for a given dictionary key.
+ ///
+ /// The initial dictionary key.
+ /// A dictionary key.
public string GetDictionaryKey(string s)
{
return s;
diff --git a/Src/Newtonsoft.Json/Serialization/INamingStrategy.cs b/Src/Newtonsoft.Json/Serialization/INamingStrategy.cs
index 3767be6f..c59f18ef 100644
--- a/Src/Newtonsoft.Json/Serialization/INamingStrategy.cs
+++ b/Src/Newtonsoft.Json/Serialization/INamingStrategy.cs
@@ -1,8 +1,23 @@
namespace Newtonsoft.Json.Serialization
{
+ ///
+ /// An interface for resolving how property names and dictionary keys are serialized.
+ ///
public interface INamingStrategy
{
+ ///
+ /// Gets the serialized name for a given property name.
+ ///
+ /// The initial property name.
+ /// A flag indicating whether the property has had a name explicitly specfied.
+ /// A property name.
string GetPropertyName(string s, bool hasSpecifiedName);
+
+ ///
+ /// Gets the serialized key for a given dictionary key.
+ ///
+ /// The initial dictionary key.
+ /// A dictionary key.
string GetDictionaryKey(string s);
}
}
\ No newline at end of file