Free cookie consent management tool by TermsFeed Policy Generator

Changeset 2736 for branches


Ignore:
Timestamp:
02/02/10 16:16:36 (15 years ago)
Author:
epitzer
Message:

allow empty MetaInfo or Tag list for composite serializers (#802)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/Persistence Test/HeuristicLab.Persistence/3.3/Core/Serializer.cs

    r2106 r2736  
    8484
    8585    public Serializer(object obj, Configuration configuration, string rootName, bool isTestRun) {
    86    
    8786      this.obj = obj;
    8887      this.rootName = rootName;
     
    174173      yield return new BeginToken(name, typeId, id);
    175174      bool first = true;
    176       foreach (var tag in metaInfo) {
    177         IEnumerator<ISerializationToken> metaIt = Serialize(new DataMemberAccessor(tag.Value, tag.Name));
    178         while (metaIt.MoveNext()) {
    179           if (first) {
    180             yield return new MetaInfoBeginToken();
    181             first = false;
     175      if (metaInfo != null) {
     176        foreach (var tag in metaInfo) {
     177          IEnumerator<ISerializationToken> metaIt = Serialize(new DataMemberAccessor(tag.Value, tag.Name));
     178          while (metaIt.MoveNext()) {
     179            if (first) {
     180              yield return new MetaInfoBeginToken();
     181              first = false;
     182            }
     183            yield return metaIt.Current;
    182184          }
    183           yield return metaIt.Current;
    184185        }
    185186      }
     
    187188        yield return new MetaInfoEndToken();
    188189      }
    189       foreach (var tag in tags) {
    190         IEnumerator<ISerializationToken> it = Serialize(new DataMemberAccessor(tag.Value, tag.Name));
    191         while (it.MoveNext())
    192           yield return it.Current;
     190      if (tags != null) {
     191        foreach (var tag in tags) {
     192          IEnumerator<ISerializationToken> it = Serialize(new DataMemberAccessor(tag.Value, tag.Name));
     193          while (it.MoveNext())
     194            yield return it.Current;
     195        }
    193196      }
    194197      yield return new EndToken(name, typeId, id);
Note: See TracChangeset for help on using the changeset viewer.