Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
ClassDataSerializer.cs
Go to the documentation of this file.
1 // Copyright (c) 2014 Silicon Studio Corp. (http://siliconstudio.co.jp)
2 // This file is distributed under GPL v3. See LICENSE.md for details.
3 namespace SiliconStudio.Core.Serialization
4 {
5  public abstract class ClassDataSerializer<T> : DataSerializer<T> where T : class, new()
6  {
7  /// <inheritdoc/>
8  public override void PreSerialize(ref T obj, ArchiveMode mode, SerializationStream stream)
9  {
10  if (mode == ArchiveMode.Deserialize && obj == null)
11  obj = new T();
12  }
13  }
14 }
Base class for implementation of SerializationStream.
override void PreSerialize(ref T obj, ArchiveMode mode, SerializationStream stream)
Describes how to serialize and deserialize an object without knowing its type. Used as a common base ...
ArchiveMode
Enumerates the different mode of serialization (either serialization or deserialization).
Definition: ArchiveMode.cs:8