- Timestamp:
- 03/17/20 14:55:23 (5 years ago)
- Location:
- branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface
- Files:
-
- 1 deleted
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/HeuristicLab.JsonInterface.csproj
r17473 r17478 61 61 </ItemGroup> 62 62 <ItemGroup> 63 <Compile Include="AdvancedTypeComparer.cs" /> 63 64 <Compile Include="Constants.cs" /> 64 65 <Compile Include="Converters\AlgorithmConverter.cs" /> … … 99 100 <Compile Include="Models\ValueLookupJsonItem.cs" /> 100 101 <Compile Include="SingleLineArrayJsonWriter.cs" /> 101 <Compile Include="Extensions\TypeExtensions.cs" />102 102 <Compile Include="JCGenerator.cs" /> 103 103 <Compile Include="JsonTemplateInstantiator.cs" /> … … 166 166 </ProjectReference> 167 167 </ItemGroup> 168 <ItemGroup /> 168 <ItemGroup> 169 <Folder Include="Extensions\" /> 170 </ItemGroup> 169 171 <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> 170 172 <PropertyGroup> -
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.