Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6736377
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:07:21+00:00 2026-05-26T11:07:21+00:00

I recently saw a declaration of enum that looks like this: <Serializable()> <Flags()> Public

  • 0

I recently saw a declaration of enum that looks like this:

<Serializable()>
<Flags()>
Public Enum SiteRoles

    ADMIN = 10 << 0
    REGULAR = 5 << 1
    GUEST = 1 << 2

End Enum

I was wondering if someone can explain what does “<<” syntax do or what it is used for? Thank you…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T11:07:21+00:00Added an answer on May 26, 2026 at 11:07 am

    These are bitwise shift operations. Bitwise shifts are used to transform the integer value of the enum mebers here to a different number. Each enum member will actually have the bit-shifted value. This is probably an obfuscation technique and is the same as setting a fixed integer value for each enum member.

    Each integer has a binary reprsentation (like 0111011); bit shifting allows bits to move to the left (<<) or right (>>) depending on which operator is used.

    For example:

    10 << 0 means:
    1010 (10 in binary form) moved with 0 bits left is 1010

    5 << 1 means:
    101 (5 in binary form) moved one bit to the left = 1010 (added a zero to the right)
    so 5 << 1 is 10 (because 1010 represents the number 10)

    and etc.

    In general the x << y operation can be seen as a fast way to calculate x * Pow(2, y);

    You can read this article for more detailed info on bit shifting in .NET http://www.blackwasp.co.uk/CSharpShiftOperators.aspx

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I recently saw code that looks like this: (function (someGlobal) { someGlobal.DoSomething(); })(someGlobal); where
I recently saw a C# constructor that look something like this... public Class foo
I recently saw a bit of code that looked like this (with sock being
I recently saw some code that reminded me to ask this question. Lately, I've
Recently I saw some code like this: <tr> <th> Some label: </th> <td> <input
In some code I saw recently there was a structure defined like this: typedef
I saw a tweet recently that confused me (this was posted by an XNA
I recently saw this constructor in a class: public MyClass(){ } There were no
I just recently saw that xcopy is deprecated and that Robocopy is recommended. I
I was reading a forum recently, and saw this comment: So, you see you've

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.