Serial Number Generation / Validation with optional 'flags'

Hi all,
I've been working on a method of generating & validating serial numbers for different applications that I'm developing, and am having issues working out exactly where to go from here.
I can generate a serial based on information provided in a few fields (names, version numbers, that kind of thing) and validate that easily enough, but what I'd really like to be able to do is select different 'features' for any given product and be able to see what features are 'enabled' by a given serial number.

From my understanding, it's possible to do something along these lines using something to do with different powers of 2, i.e. if option A = 1, B = 2, C = 4, D = 8 and E = 16, and we were to validate a value of 19, we would be able to tell that option A, B, and E were selected.

Is there an easy way for me to begin working on this that someone has previously come across, or could someone point me to any documentation?


Who is Participating?
GregTSmithConnect With a Mentor Commented:
You might have better luck posting this question under the language you're using.  

In C#.NET an enumeration can use a "Flags" attribute that allows what you mention.  The documentation for it should help you get a sense for what you need to do.  You can read about it here:
vixtroAuthor Commented:
Thanks for that. It looks like that's the kind of thing i'm after, going to require a bit of digging around to implement it I think!
I'm using VB.NET at the moment, .NET 3.5.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.