Enum ToString with user friendly strings

后端 未结 23 1788
伪装坚强ぢ
伪装坚强ぢ 2020-11-22 11:44

My enum consists of the following values:

private enum PublishStatusses{
    NotCompleted,
    Completed,
    Error
};

I want to be able to

23条回答
  •  感情败类
    2020-11-22 12:31

    In case you just want to add a whitespace between the words, it is as simple as

    string res = Regex.Replace(PublishStatusses.NotCompleted, "[A-Z]", " $0").Trim();
    

提交回复
热议问题