Skip to content

Instantly share code, notes, and snippets.

@starteleport
Last active December 11, 2015 10:18
Show Gist options
  • Save starteleport/4585278 to your computer and use it in GitHub Desktop.
Save starteleport/4585278 to your computer and use it in GitHub Desktop.
Part of Convert<T, P> class
private static P SameType (P p) { return p; }
private static T Assignable(P p) { return (T)(object)p; }
private static T Default(P p) { return (p as IConvertible) == null ? (T)(object)p : (T)System.Convert.ChangeType(p, typeof(T), Thread.CurrentThread.CurrentCulture); }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment