Definition:
/// <summary> /// The js function type(the same as name). /// </summary> [Flags] public enum CallJSFunctionTypes { None = 0, ResetFixedBar = 1 << 1, ResetRequiredField = 1 << 2, SetValidateSuccessTextBoxStyle = 1 << 3, SetValidateFailTextBoxStyle = 1 << 4, ResizeSummary = 1 << 5 //,All = 1 << 5 - 1 }
Usage:
// You can give an initial value. calljsfunctiontypes jsfunctions = calljsfunctiontypes. none ;//... // you can assign values in this way, and overlay them with "and" if you want to include any meaning. jsfunctions = calljsfunctiontypes. resetfixedbar | calljsfunctiontypes. resetrequiredfield | calljsfunctiontypes. resizesummary ;//... // determine whether it contains a certain meaning if (jsfunctions & calljsfunctiontypes. resetfixedbar) = calljsfunctiontypes. resetfixedbar) {// do something .}
Principle:
Int32 is a 4-byte 32-bit binary
None = 0,
That is, 0000 0000 0000 0000 0000 0000 0000
Resetfixedbar = 1 <1,
That is, 0000 0000 0000 0000 0000 0000 0000-> 0001 0000 0000 0000 0000 0000 0000 0000
Resetrequiredfield = 1 <2,
That is, 0000 0000 0000 0000 0000 0000 0000-> 0001 0000 0000 0000 0000 0000 0000 0000
Setvalidatesuccesstextboxstyle = 1 <3,
That is, 0000 0000 0000 0000 0000 0000 0000-> 0001 0000 0000 0000 0000 0000 0000 0000
Setvalidatefailtextboxstyle = 1 <4,
That is, 0000 0000 0000 0000 0000 0000 0000-> 0001 0000 0000 0000 0000 0000 0000 0001
Resizesummary = 1 <5,
That is, 0000 0000 0000 0000 0000 0000 0000-> 0001 0000 0000 0000 0000 0000 0000 0010
All = 1 <5-1
That is, 0000 0000 0000 0000 0000 0000 0010-> 0000 0000 0000 0000 0000 0000 0000 0001
When assigning values:
Resetfixedbar | setvalidatesuccesstextboxstyle | resizesummary
That is
0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0010
____________________________________
0000 0000 0000 0000 0000 0000 0010
When judging:
Determine whether there is a resetfixedbar, phase "and "(&)
0000 0000 0000 0000 0000 0000 0010
0000 0000 0000 0000 0000 0000 0000
____________________________________
0000 0000 0000 0000 0000 0000 0000 resetfixedbar
Determine whether resetrequiredfield, phase "and" (&) exist "(&)
0000 0000 0000 0000 0000 0000 0010
0000 0000 0000 0000 0000 0000 0000
____________________________________
0000 0000 0000 0000 0000 0000 0000 no resetfixedbar