Merge branch 'issue-143-dynamic-property-types' of https://github.com/Athari/Newtonsoft.Json into Athari-issue-143-dynamic-property-types
This commit is contained in:
@@ -611,17 +611,6 @@ namespace Newtonsoft.Json.Linq
|
||||
return ((ICustomTypeDescriptor)this).GetProperties(null);
|
||||
}
|
||||
|
||||
private static Type GetTokenPropertyType(JToken token)
|
||||
{
|
||||
if (token is JValue)
|
||||
{
|
||||
JValue v = (JValue)token;
|
||||
return (v.Value != null) ? v.Value.GetType() : typeof(object);
|
||||
}
|
||||
|
||||
return token.GetType();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the properties for this instance of a component using the attribute array as a filter.
|
||||
/// </summary>
|
||||
@@ -635,7 +624,7 @@ namespace Newtonsoft.Json.Linq
|
||||
|
||||
foreach (KeyValuePair<string, JToken> propertyValue in this)
|
||||
{
|
||||
descriptors.Add(new JPropertyDescriptor(propertyValue.Key, GetTokenPropertyType(propertyValue.Value)));
|
||||
descriptors.Add(new JPropertyDescriptor(propertyValue.Key));
|
||||
}
|
||||
|
||||
return descriptors;
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using Newtonsoft.Json.Utilities;
|
||||
|
||||
namespace Newtonsoft.Json.Linq
|
||||
{
|
||||
@@ -35,20 +34,13 @@ namespace Newtonsoft.Json.Linq
|
||||
/// </summary>
|
||||
public class JPropertyDescriptor : PropertyDescriptor
|
||||
{
|
||||
private readonly Type _propertyType;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="JPropertyDescriptor"/> class.
|
||||
/// </summary>
|
||||
/// <param name="name">The name.</param>
|
||||
/// <param name="propertyType">Type of the property.</param>
|
||||
public JPropertyDescriptor(string name, Type propertyType)
|
||||
public JPropertyDescriptor(string name)
|
||||
: base(name, null)
|
||||
{
|
||||
ValidationUtils.ArgumentNotNull(name, "name");
|
||||
ValidationUtils.ArgumentNotNull(propertyType, "propertyType");
|
||||
|
||||
_propertyType = propertyType;
|
||||
}
|
||||
|
||||
private static JObject CastInstance(object instance)
|
||||
@@ -149,7 +141,7 @@ namespace Newtonsoft.Json.Linq
|
||||
/// </returns>
|
||||
public override Type PropertyType
|
||||
{
|
||||
get { return _propertyType; }
|
||||
get { return typeof(object); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user