-Build
This commit is contained in:
@@ -86,14 +86,14 @@ namespace Newtonsoft.Json.Serialization
|
||||
if (property.DeclaringType != null && existingProperty.DeclaringType != null)
|
||||
{
|
||||
if (property.DeclaringType.IsSubclassOf(existingProperty.DeclaringType)
|
||||
|| (existingProperty.DeclaringType.IsInterface && property.DeclaringType.ImplementInterface(existingProperty.DeclaringType)))
|
||||
|| (existingProperty.DeclaringType.IsInterface() && property.DeclaringType.ImplementInterface(existingProperty.DeclaringType)))
|
||||
{
|
||||
// current property is on a derived class and hides the existing
|
||||
Remove(existingProperty);
|
||||
duplicateProperty = false;
|
||||
}
|
||||
if (existingProperty.DeclaringType.IsSubclassOf(property.DeclaringType)
|
||||
|| (property.DeclaringType.IsInterface && existingProperty.DeclaringType.ImplementInterface(property.DeclaringType)))
|
||||
|| (property.DeclaringType.IsInterface() && existingProperty.DeclaringType.ImplementInterface(property.DeclaringType)))
|
||||
{
|
||||
// current property is hidden by the existing so don't add it
|
||||
return;
|
||||
|
||||
@@ -553,13 +553,12 @@ namespace Newtonsoft.Json.Utilities
|
||||
|
||||
public static bool ImplementInterface(this Type type, Type interfaceType)
|
||||
{
|
||||
for (Type currentType = type; currentType != null; currentType = currentType.BaseType)
|
||||
for (Type currentType = type; currentType != null; currentType = currentType.BaseType())
|
||||
{
|
||||
Type[] interfaces = currentType.GetInterfaces();
|
||||
|
||||
for (int i = 0; i < interfaces.Length; i++)
|
||||
IEnumerable<Type> interfaces = currentType.GetInterfaces();
|
||||
foreach (Type i in interfaces)
|
||||
{
|
||||
if (interfaces[i] == interfaceType || (interfaces[i] != null && interfaces[i].ImplementInterface(interfaceType)))
|
||||
if (i == interfaceType || (i != null && i.ImplementInterface(interfaceType)))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user