Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
CecilArraySerializerFactory.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 using Mono.Cecil;
4 
5 namespace SiliconStudio.AssemblyProcessor
6 {
7  /// <summary>
8  /// Generates array serializer type from a given array type.
9  /// </summary>
11  {
12  private readonly TypeReference genericArraySerializerType;
13 
14  public CecilArraySerializerFactory(TypeReference genericArraySerializerType)
15  {
16  this.genericArraySerializerType = genericArraySerializerType;
17  }
18 
19  public TypeReference GetSerializer(TypeReference objectType)
20  {
21  if (objectType.IsArray)
22  {
23  return genericArraySerializerType.MakeGenericType(((ArrayType)objectType).ElementType);
24  }
25 
26  return null;
27  }
28  }
29 }
CecilArraySerializerFactory(TypeReference genericArraySerializerType)
TypeReference GetSerializer(TypeReference objectType)
Gets the serializer type from a given object type.
Gives the required generic serializer for a given type. This is useful for generation of serializatio...
Generates array serializer type from a given array type.