using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace RomCheater { /// /// A class that allows the binding of an object to another type /// public class TypeBinder { ///// ///// Binds an object to a specific type ///// ///// The destination object type ///// The source object type (object) ///// A bound type //public static void Bind(object source, out T destination) where T : class { Bind(source, out destination); } /// /// Bind an object of a specific type to another specific type /// /// The source object type /// The destination object type /// An instance of the source type /// A bound typ public static void Bind(S source, out T destination) where T : class { destination= (source as T) == null ? (T)Convert.ChangeType(source, typeof(T)) : (source as T); } } }