Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.Persistence/3.3/Core/FormatBase.cs @ 1574

Last change on this file since 1574 was 1574, checked in by epitzer, 15 years ago

Fix problem with loading configuration. Properly initialize and register instance for empty types and make sure Formats have comparable hash codes. (#583)

File size: 714 bytes
Line 
1using System;
2
3namespace HeuristicLab.Persistence.Interfaces {
4
5  public abstract class FormatBase<SerialDataFormat> : IFormat<SerialDataFormat> where SerialDataFormat : ISerialData {
6
7    public abstract string Name { get; }
8
9    public Type SerialDataType { get { return typeof(SerialDataFormat); } }
10
11    public bool Equals(FormatBase<SerialDataFormat> f) {
12      if (f == null)
13        return false;
14      return f.Name == this.Name;
15    }
16
17    public override bool Equals(object obj) {
18      FormatBase<SerialDataFormat> f = obj as FormatBase<SerialDataFormat>;
19      return Equals(f);
20    }
21
22    public override int GetHashCode() {
23      return Name.GetHashCode();
24    }
25
26  }
27
28}
Note: See TracBrowser for help on using the repository browser.