Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
ObjectToType.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 System;
4 using System.Globalization;
5 
6 namespace SiliconStudio.Presentation.ValueConverters
7 {
8  /// <summary>
9  /// This converter convert any object to its type. It accepts null and will return null in this case.
10  /// </summary>
11  /// <seealso cref="ObjectToFullTypeName"/>
12  /// <seealso cref="ObjectToTypeName"/>
13  public class ObjectToType : OneWayValueConverter<ObjectToType>
14  {
15  /// <summary>
16  /// The string representation of the type of a null object
17  /// </summary>
18  public const string NullObjectType = "(null)";
19 
20  /// <inheritdoc/>
21  public override object Convert(object value, Type targetType, object parameter, CultureInfo culture)
22  {
23  return value == null ? null : value.GetType();
24  }
25  }
26 }
This converter convert any object to its type. It accepts null and will return null in this case...
Definition: ObjectToType.cs:13
override object Convert(object value, Type targetType, object parameter, CultureInfo culture)
Definition: ObjectToType.cs:21