/// <summary> /// Returns a sorted list of the fields of the provided type. /// </summary> /// <param name="type">The type.</param> /// <param name="fieldFilter">The predicate used in addition to the default logic to select which fields are included.</param> /// <returns>A sorted list of the fields of the provided type.</returns> private List <FieldInfo> GetFields(Type type, Func <FieldInfo, bool> fieldFilter = null) { var result = type.GetAllFields().Where( field => field.GetCustomAttribute <NonSerializedAttribute>() == null && !field.IsStatic && IlBasedSerializerTypeChecker.IsSupportedFieldType(field.FieldType.GetTypeInfo()) && (fieldFilter == null || fieldFilter(field))).ToList(); result.Sort(FieldInfoComparer.Instance); return(result); }
/// <summary> /// Informs the serialization manager whether this serializer supports the type for serialization. /// </summary> /// <param name="t">The type of the item to be serialized</param> /// <returns>A value indicating whether the item can be serialized.</returns> public bool IsSupportedType(Type t) => IlBasedSerializerTypeChecker.IsSupportedType(t.GetTypeInfo());