Advertisement
Guest User

Untitled

a guest
Feb 20th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement