Changeset 17478 for branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/JsonItemConverter.cs
- Timestamp:
- 03/17/20 14:55:23 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/JsonItemConverter.cs
r17439 r17478 40 40 41 41 foreach (var x in Converters) 42 if ( type.IsEqualTo(x.Key))42 if (CompareTypes(type, x.Key)) 43 43 possibleConverters.Add(x.Value); 44 44 … … 91 91 Converters = converters; 92 92 } 93 94 private bool CompareGenericTypes(Type t1, Type t2) => 95 (t1.IsGenericType && t1.GetGenericTypeDefinition() == t2) || 96 (t2.IsGenericType && t2.GetGenericTypeDefinition() == t1); 97 98 private bool CompareTypes(Type t1, Type t2) => 99 t1 == t2 || t1.IsAssignableFrom(t2) || 100 t1.GetInterfaces().Any( 101 i => i == t2 || CompareGenericTypes(i, t2) 102 ) || 103 CompareGenericTypes(t1, t2); 93 104 } 94 105 }
Note: See TracChangeset
for help on using the changeset viewer.