private static bool IsTypeDictionary (Type type) { return type.GetInterfaces().Any(it => it == typeof(IDictionary)) || GetGenericInterface(type, typeof(IDictionary<,>)) != null; }