Fix for "inherited" interfaces

This commit is contained in:
ravensorb
2015-04-01 23:08:58 -05:00
parent f809e30a51
commit 16d0c09027
2 changed files with 29 additions and 5 deletions
@@ -883,8 +883,20 @@ namespace Newtonsoft.Json.Utilities
{
ValidationUtils.ArgumentNotNull(targetType, "targetType");
List<PropertyInfo> propertyInfos = new List<PropertyInfo>(targetType.GetProperties(bindingAttr));
GetChildPrivateProperties(propertyInfos, targetType, bindingAttr);
List<PropertyInfo> propertyInfos;
if (!targetType.IsInterface())
{
propertyInfos = new List<PropertyInfo>(targetType.GetProperties(bindingAttr));
}
else
{
propertyInfos = (new Type[] { targetType })
.Concat(targetType.GetInterfaces())
.SelectMany(i => i.GetProperties()).ToList();
}
GetChildPrivateProperties(propertyInfos, targetType, bindingAttr);
// a base class private getter/setter will be inaccessable unless the property was gotten from the base class
for (int i = 0; i < propertyInfos.Count; i++)