-Removed generic SerializeObject methods

This commit is contained in:
James Newton-King
2015-12-12 18:14:57 +13:00
parent 2c7a51c50a
commit a5d1a41e14
4 changed files with 4 additions and 60 deletions
@@ -133,7 +133,7 @@ namespace Newtonsoft.Json.Tests.Converters
[Test]
public void SerializeNullRoot()
{
string json = JsonConvert.SerializeObject<DataSet>(null, new JsonSerializerSettings
string json = JsonConvert.SerializeObject(null, typeof(DataSet), new JsonSerializerSettings
{
Formatting = Formatting.Indented
});
@@ -481,7 +481,7 @@ namespace Newtonsoft.Json.Tests.Converters
[Test]
public void SerializeNullRoot()
{
string json = JsonConvert.SerializeObject<DataTable>(null, new JsonSerializerSettings
string json = JsonConvert.SerializeObject(null, typeof(DataTable), new JsonSerializerSettings
{
Formatting = Formatting.Indented
});
@@ -248,7 +248,7 @@ namespace Newtonsoft.Json.Tests.Serialization
[Test]
public void SerializeRootTypeNameAutoWithJsonConvert_Generic()
{
string json = JsonConvert.SerializeObject<object>(new WagePerson(), Formatting.Indented, new JsonSerializerSettings
string json = JsonConvert.SerializeObject(new WagePerson(), typeof(object), Formatting.Indented, new JsonSerializerSettings
{
TypeNameHandling = TypeNameHandling.Auto
});
@@ -265,7 +265,7 @@ namespace Newtonsoft.Json.Tests.Serialization
[Test]
public void SerializeRootTypeNameAutoWithJsonConvert_Generic2()
{
string json = JsonConvert.SerializeObject<object>(new WagePerson(), new JsonSerializerSettings
string json = JsonConvert.SerializeObject(new WagePerson(), typeof(object), new JsonSerializerSettings
{
TypeNameHandling = TypeNameHandling.Auto
});
-56
View File
@@ -530,17 +530,6 @@ namespace Newtonsoft.Json
return SerializeObject(value, null, (JsonSerializerSettings)null);
}
/// <summary>
/// Serializes the specified object to a JSON string.
/// </summary>
/// <typeparam name="T">The type of the object to serialize.</typeparam>
/// <param name="value">The object to serialize.</param>
/// <returns>A JSON string representation of the object.</returns>
public static string SerializeObject<T>(object value)
{
return SerializeObject(value, typeof(T), (JsonSerializerSettings)null);
}
/// <summary>
/// Serializes the specified object to a JSON string using formatting.
/// </summary>
@@ -554,20 +543,6 @@ namespace Newtonsoft.Json
return SerializeObject(value, formatting, (JsonSerializerSettings)null);
}
/// <summary>
/// Serializes the specified object to a JSON string using formatting.
/// </summary>
/// <typeparam name="T">The type of the object to serialize.</typeparam>
/// <param name="value">The object to serialize.</param>
/// <param name="formatting">Indicates how the output is formatted.</param>
/// <returns>
/// A JSON string representation of the object.
/// </returns>
public static string SerializeObject<T>(object value, Formatting formatting)
{
return SerializeObject(value, typeof(T), (JsonSerializerSettings)null);
}
/// <summary>
/// Serializes the specified object to a JSON string using a collection of <see cref="JsonConverter"/>.
/// </summary>
@@ -613,21 +588,6 @@ namespace Newtonsoft.Json
return SerializeObject(value, null, settings);
}
/// <summary>
/// Serializes the specified object to a JSON string using <see cref="JsonSerializerSettings"/>.
/// </summary>
/// <typeparam name="T">The type of the object to serialize.</typeparam>
/// <param name="value">The object to serialize.</param>
/// <param name="settings">The <see cref="JsonSerializerSettings"/> used to serialize the object.
/// If this is null, default serialization settings will be used.</param>
/// <returns>
/// A JSON string representation of the object.
/// </returns>
public static string SerializeObject<T>(T value, JsonSerializerSettings settings)
{
return SerializeObject(value, typeof(T), settings);
}
/// <summary>
/// Serializes the specified object to a JSON string using a type, formatting and <see cref="JsonSerializerSettings"/>.
/// </summary>
@@ -664,22 +624,6 @@ namespace Newtonsoft.Json
return SerializeObject(value, null, formatting, settings);
}
/// <summary>
/// Serializes the specified object to a JSON string using formatting and <see cref="JsonSerializerSettings"/>.
/// </summary>
/// <typeparam name="T">The type of the object to serialize.</typeparam>
/// <param name="value">The object to serialize.</param>
/// <param name="formatting">Indicates how the output is formatted.</param>
/// <param name="settings">The <see cref="JsonSerializerSettings"/> used to serialize the object.
/// If this is null, default serialization settings will be used.</param>
/// <returns>
/// A JSON string representation of the object.
/// </returns>
public static string SerializeObject<T>(T value, Formatting formatting, JsonSerializerSettings settings)
{
return SerializeObject(value, typeof(T), formatting, settings);
}
/// <summary>
/// Serializes the specified object to a JSON string using a type, formatting and <see cref="JsonSerializerSettings"/>.
/// </summary>