这有效:

enum TPriority
{
    EPriorityIdle = -100,
    EPriorityLow = -20,
    EPriorityStandard = 0,
    EPriorityUserInput = 10,
    EPriorityHigh = 20
};

TPriority priority = EPriorityIdle;

但这不起作用:
TPriority priority = -100;

任何原因?

最佳答案

它也可以使用,但是您需要显式类型

TPriority priority = (TPriority)-100;

07-25 20:32