Free cookie consent management tool by TermsFeed Policy Generator

Changeset 9388


Ignore:
Timestamp:
04/22/13 15:26:35 (9 years ago)
Author:
mkommend
Message:

#1890: Fixed the NumberArray2XmlSerializerBase to allow the persistence of multidimensional arrarys with length components of size 0.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/Compact/NumberArray2XmlSerializerBase.cs

    r7259 r9388  
    2323using System.Collections;
    2424using System.Collections.Generic;
     25using System.Linq;
    2526using System.Text;
    2627using HeuristicLab.Persistence.Auxiliary;
     
    5657        lowerBounds[i] = a.GetLowerBound(i);
    5758      }
     59      if (lengths.Any(l => l == 0))
     60        return new XmlString(sb.ToString());
    5861      int[] positions = (int[])lowerBounds.Clone();
    5962      while (positions[a.Rank - 1] < lengths[a.Rank - 1] + lowerBounds[a.Rank - 1]) {
     
    102105          }
    103106        }
    104         if (positions[rank - 1] != lowerBounds[rank - 1] + lengths[rank - 1])
     107        if (positions[rank - 1] != lowerBounds[rank - 1] + lengths[rank - 1] && lengths.All(l => l != 0))
    105108          throw new PersistenceException("Insufficient number of elements while trying to fill number array.");
    106109        return (T)(object)a;
Note: See TracChangeset for help on using the changeset viewer.