daily pastebin goal
62%
SHARE
TWEET

Untitled

a guest Feb 20th, 2019 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public void UpdateStatus(string itemType, string newStatus)
  2.         {
  3.             itemType = itemType + "Status";
  4.  
  5.             var targetAssembly = Assembly.GetAssembly(typeof(IWorkItem));
  6.  
  7.             var targetType = targetAssembly.GetTypes().FirstOrDefault(x => x.Name.Contains(itemType) && !(x.IsAbstract));
  8.  
  9.             Enum.Parse(targetType, newStatus);
  10.  
  11.             // Only if the Enum.Parse pass, we will set the new value;
  12.             this.Status = newStatus;
  13.         }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top