Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.Persistence/3.3/Core/Tokens/SerializationTokenBase.cs @ 3390

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

Update API docs. (#548)

File size: 1.2 KB
Line 
1using HeuristicLab.Persistence.Interfaces;
2using System.Reflection;
3using System.Text;
4
5namespace HeuristicLab.Persistence.Core.Tokens {
6
7  /// <summary>
8  /// Common base class for all serialization tokens.
9  /// </summary>
10  public abstract class SerializationTokenBase : ISerializationToken {
11
12    /// <summary>
13    /// The token's name.
14    /// </summary>
15    public readonly string Name;
16
17    /// <summary>
18    /// Initializes a new instance of the <see cref="SerializationTokenBase"/> class.
19    /// </summary>
20    /// <param name="name">The token name.</param>
21    public SerializationTokenBase(string name) {
22      Name = name;
23    }
24
25    /// <summary>
26    /// Returns a <see cref="System.String"/> that represents this instance.
27    /// </summary>
28    /// <returns>
29    /// A <see cref="System.String"/> that represents this instance.
30    /// </returns>
31    public override string ToString() {
32      StringBuilder sb = new StringBuilder();
33      sb.Append(this.GetType().Name).Append('(');
34      foreach (FieldInfo fi in this.GetType().GetFields()) {
35        sb.Append(fi.Name).Append('=').Append(fi.GetValue(this)).Append(", ");
36      }
37      sb.Append(')');
38      return sb.ToString();
39    }
40  }
41
42}
Note: See TracBrowser for help on using the repository browser.