好了,所以我是新來的C#,對我的生活中,我無法理解究竟是什麼下面的代碼(從一個傳統的項目)是應該做的:標誌和<<枚舉操作? C#
[Flags]
public enum EAccountStatus
{
None = 0,
FreeServiceApproved = 1 << 0,
GovernmentAccount = 1 << 1,
PrivateOrganisationAccount = 1 << 2,
All = 8
}
究竟做了<<
運營商做這裏的枚舉?我們爲什麼需要這個?
請檢查pmg的答案:http://stackoverflow.com/questions/3999922/why-use-the-bitwise-shift-operat or-for-values-in-a-c-enum-definition – manish
想知道爲什麼他不使用'All = 1 << 3'? –
謝謝@manish,這也是一個輝煌的答案:) –