Skip to main content
deleted 61 characters in body
Source Link
dtb
  • 217.8k
  • 37
  • 413
  • 438

If you want to convert them by value, you can use this:

(SystemPersonTitles)PersonTitle.Mr; 

If you want to convert them by name, you can use this:

public bool TryConvertToSystemPersonTitles( PersonTitle personTitle, out SystemPersonTitles result) { string name = PersonTitle.Mr.ToString();   SystemPersonTitles converted;  return Enum.TryParse(namepersonTitle.ToString(), out result); } 

If you want to convert them by value, you can use this:

(SystemPersonTitles)PersonTitle.Mr; 

If you want to convert them by name, you can use this:

public bool TryConvertToSystemPersonTitles(PersonTitle personTitle, out SystemPersonTitles result) { string name = PersonTitle.Mr.ToString();   SystemPersonTitles converted;  return Enum.TryParse(name, out result); } 

If you want to convert them by value, you can use this:

(SystemPersonTitles)PersonTitle.Mr; 

If you want to convert them by name, you can use this:

public bool TryConvertToSystemPersonTitles( PersonTitle personTitle, out SystemPersonTitles result) { return Enum.TryParse(personTitle.ToString(), out result); } 
Source Link
Sam Harwell
  • 100.3k
  • 22
  • 216
  • 283

If you want to convert them by value, you can use this:

(SystemPersonTitles)PersonTitle.Mr; 

If you want to convert them by name, you can use this:

public bool TryConvertToSystemPersonTitles(PersonTitle personTitle, out SystemPersonTitles result) { string name = PersonTitle.Mr.ToString(); SystemPersonTitles converted; return Enum.TryParse(name, out result); }