Can anyone suggest a simple way to count the number of associated flags as I'm not quite sure how to do so, in a simple way other than repetedly dividing by 2^n...
Code:
[Flags] public enum Test { Test1 = 1, Test2 = 2, Test3 = 4, Test4 = 8, Test5 = 16, Test6 = 32, Test7 = 64, Test8 = 128 } public static int Count(ref Test test) { // return number of Tests (e.g. 01001001 = 3 ) }
Comment