Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/10/10 16:37:52 (14 years ago)
Author:
epitzer
Message:

add justifications for rejecting a type for serialization in ICompositeSerializer (#548)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/KeyValuePairSerializer.cs

    r1823 r2993  
    1616    }
    1717
     18    private static readonly Type genericKeyValuePairType =
     19      typeof(KeyValuePair<int, int>).GetGenericTypeDefinition();
    1820
    1921    public bool CanSerialize(Type type) {
    2022      return type.IsGenericType &&
    21              type.GetGenericTypeDefinition() ==
    22              typeof(KeyValuePair<int, int>).GetGenericTypeDefinition();
     23             type.GetGenericTypeDefinition() == genericKeyValuePairType;             
     24    }
     25
     26    public string JustifyRejection(Type type) {
     27      if (!type.IsGenericType)
     28        return "not even generic";     
     29      return "not generic KeyValuePair<,>";
    2330    }
    2431
Note: See TracChangeset for help on using the changeset viewer.