- Timestamp:
- 06/21/10 18:46:04 (14 years ago)
- Location:
- trunk/sources/HeuristicLab.Persistence/3.3/Default/CompositeSerializers
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/CompactNumberArray2StringSerializer.cs
r3742 r3937 21 21 22 22 using System; 23 using System.Linq; 23 24 using HeuristicLab.Persistence.Interfaces; 24 25 using HeuristicLab.Persistence.Core; … … 28 29 using System.Text; 29 30 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 31 using HeuristicLab.Persistence.Auxiliary; 30 32 31 33 namespace HeuristicLab.Persistence.Default.CompositeSerializers { … … 58 60 int[] lengths = new int[a.Rank]; 59 61 int[] lowerBounds = new int[a.Rank]; 60 StringBuilder sb = new StringBuilder( );62 StringBuilder sb = new StringBuilder(a.Rank * 3); 61 63 sb.Append(a.Rank).Append(';'); 64 int capacity = 1; 62 65 for (int i = 0; i < a.Rank; i++) { 63 66 sb.Append(a.GetLength(i)).Append(';'); 64 67 lengths[i] = a.GetLength(i); 68 capacity *= lengths[i]; 65 69 } 70 sb.EnsureCapacity(capacity * 3); 66 71 for (int i = 0; i < a.Rank; i++) { 67 72 sb.Append(a.GetLowerBound(i)).Append(';'); … … 92 97 var tagIter = metaInfo.GetEnumerator(); 93 98 tagIter.MoveNext(); 94 var valueIter = ((string)tagIter.Current.Value) 95 .Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries) 96 .GetEnumerator(); 99 var valueIter = ((string)tagIter.Current.Value).GetSplitEnumerator(';'); 97 100 valueIter.MoveNext(); 98 101 int rank = int.Parse((string)valueIter.Current); -
trunk/sources/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/NumberEnumerable2StringSerializer.cs
r3742 r3937 93 93 } 94 94 95 private static object[] emptyArgs = new object[0]; 95 96 public IEnumerable<Tag> Decompose(object obj) { 96 97 Type type = obj.GetType(); … … 102 103 iMap.InterfaceMethods, 103 104 enumerable.GetMethod("GetEnumerator"))]; 104 object[] empty = new object[] { }; 105 object genericEnumerator = getEnumeratorMethod.Invoke(obj, empty); 105 object genericEnumerator = getEnumeratorMethod.Invoke(obj, emptyArgs); 106 106 MethodInfo moveNextMethod = genericEnumerator.GetType().GetMethod("MoveNext"); 107 107 PropertyInfo currentProperty = genericEnumerator.GetType().GetProperty("Current"); 108 108 StringBuilder sb = new StringBuilder(); 109 while ((bool)moveNextMethod.Invoke(genericEnumerator, empty ))109 while ((bool)moveNextMethod.Invoke(genericEnumerator, emptyArgs)) 110 110 sb.Append( 111 111 numberConverter.Format(
Note: See TracChangeset
for help on using the changeset viewer.