Advertisement
Guest User

Untitled

a guest
Jan 17th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. public static class StateHelper
  2. {
  3. public static TStateClass CreateState<TStateClass, TStateValue>(TStateValue stateValue)
  4. where TStateClass : State<TStateValue> where TStateValue : struct, IComparable
  5. {
  6. var state = typeof(TStateClass).GetConcreteChild(Enum.GetName(typeof(TStateValue), stateValue));
  7. return (TStateClass)Activator.CreateInstance(state);
  8. }
  9. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement