奇妙なことに、私には2つの列挙型セットがあります。
public enum ComponentActionTypes {
Add = 0,
Move = 1,
Delete = 2,
Edit = 3,
Enable = 4,
Disable = 5
}
public enum ComponentNames {
Component = 0,
Logo = 1,
Main_menu = 2,
Search_box = 3,
Highlighter = 4,
RSS = 5,
Twitter = 6,
YouTube = 7
}
次のテキストを印刷しようとすると、
ActionText =
string.Format("{0}ed a {1}", action.ComponentActionType, action.ComponentName);
生成されます:
184ed a Logo
それ以外のAdded a Logo
action.ComponentActionType
数値に変換され(ToString
役に立たなかった)、また
奇妙な数(184
列挙型自体ではなく、のように)
これを解決する方法はありますか?
アップデート:
namespace BrandToolbar.Common.ActionLog.Model
{
public class ActionItem
{
public Guid UserId { get; set; }
public Int64 PublicId { get; set; }
public ComponentActionTypes ComponentActionType { get; set; }
public DateTime Date { get; set; }
public ComponentNames ComponentName { get; set; }
public string UiJsonPreview { get; set; }
}
}
public static ActionItemUI ConvertModelToUiObj(ActionItem action)
{
return new ActionItemUI()
{
ActionText = string.Format(
"{0}ed a {1}",
action.ComponentActionType,
action.ComponentName
).Replace("_", " "),
TooltipText = string.Format(
"{0}ed on {1}",
action.ComponentActionType,
action.Date.ToString(StringFormatter.DateFormat)
),
ImageUrl = string.Empty,
ConponentText = string.Empty
};
}