-Removed generic SerializeObject methods
This commit is contained in:
@@ -133,7 +133,7 @@ namespace Newtonsoft.Json.Tests.Converters
|
|||||||
[Test]
|
[Test]
|
||||||
public void SerializeNullRoot()
|
public void SerializeNullRoot()
|
||||||
{
|
{
|
||||||
string json = JsonConvert.SerializeObject<DataSet>(null, new JsonSerializerSettings
|
string json = JsonConvert.SerializeObject(null, typeof(DataSet), new JsonSerializerSettings
|
||||||
{
|
{
|
||||||
Formatting = Formatting.Indented
|
Formatting = Formatting.Indented
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -481,7 +481,7 @@ namespace Newtonsoft.Json.Tests.Converters
|
|||||||
[Test]
|
[Test]
|
||||||
public void SerializeNullRoot()
|
public void SerializeNullRoot()
|
||||||
{
|
{
|
||||||
string json = JsonConvert.SerializeObject<DataTable>(null, new JsonSerializerSettings
|
string json = JsonConvert.SerializeObject(null, typeof(DataTable), new JsonSerializerSettings
|
||||||
{
|
{
|
||||||
Formatting = Formatting.Indented
|
Formatting = Formatting.Indented
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -248,7 +248,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
|||||||
[Test]
|
[Test]
|
||||||
public void SerializeRootTypeNameAutoWithJsonConvert_Generic()
|
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
|
TypeNameHandling = TypeNameHandling.Auto
|
||||||
});
|
});
|
||||||
@@ -265,7 +265,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
|||||||
[Test]
|
[Test]
|
||||||
public void SerializeRootTypeNameAutoWithJsonConvert_Generic2()
|
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
|
TypeNameHandling = TypeNameHandling.Auto
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -530,17 +530,6 @@ namespace Newtonsoft.Json
|
|||||||
return SerializeObject(value, null, (JsonSerializerSettings)null);
|
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>
|
/// <summary>
|
||||||
/// Serializes the specified object to a JSON string using formatting.
|
/// Serializes the specified object to a JSON string using formatting.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -554,20 +543,6 @@ namespace Newtonsoft.Json
|
|||||||
return SerializeObject(value, formatting, (JsonSerializerSettings)null);
|
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>
|
/// <summary>
|
||||||
/// Serializes the specified object to a JSON string using a collection of <see cref="JsonConverter"/>.
|
/// Serializes the specified object to a JSON string using a collection of <see cref="JsonConverter"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -613,21 +588,6 @@ namespace Newtonsoft.Json
|
|||||||
return SerializeObject(value, null, settings);
|
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>
|
/// <summary>
|
||||||
/// Serializes the specified object to a JSON string using a type, formatting and <see cref="JsonSerializerSettings"/>.
|
/// Serializes the specified object to a JSON string using a type, formatting and <see cref="JsonSerializerSettings"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -664,22 +624,6 @@ namespace Newtonsoft.Json
|
|||||||
return SerializeObject(value, null, formatting, settings);
|
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>
|
/// <summary>
|
||||||
/// Serializes the specified object to a JSON string using a type, formatting and <see cref="JsonSerializerSettings"/>.
|
/// Serializes the specified object to a JSON string using a type, formatting and <see cref="JsonSerializerSettings"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user