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

  • SEARCH
  • Home
  • 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 8900333
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T01:04:53+00:00 2026-06-15T01:04:53+00:00

I have an enumeration declared as such [Flags] public enum PermissionEnum { [EnumStringValue(None)] None

  • 0

I have an enumeration declared as such

[Flags]
public enum PermissionEnum
{
    [EnumStringValue("None")]
    None = 0x0,
    [EnumStringValue("Create")]
    Create = 0x1,
    [EnumStringValue("Edit")]
    Edit = 0x2,
    [EnumStringValue("View")]
    View = 0x4
}

I subsequently have some linq that attempts to obtain the highest permission available.

List<SecurityRolePermissionView> AvailablePermissions = GetPermissions();

SecurityRolePermissionView HighestPermission = AvailablePermissions.OrderByDescending(o => o.Permission).FirstOrDefault();

With the current enumeration values this seems to do what it suggests it will do. However, I am pretty confident that this code is incorrect but I’m not sure I could explain why or how to achieve a correct implementation.

Either way, could someone please be kind enough to confirm if this is in-fact incorrect (and why) and provide an explanation of how to achieve my desired result?

EDIT: I might not have been clear enough in explaining what my highest permission is. This is a flags enumeration. Therefore it can contain any combination of None, Create, Edit, View. What I am looking to find as the highest is basically Create + Edit + View. If that Fails, Edit + View and lastly View

  • 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-06-15T01:04:53+00:00Added an answer on June 15, 2026 at 1:04 am

    Enum ordering is the same as the ordering of the enum’s underlying type (C# specification section 7.9.5, “Enumeration operators”). Therefore, this is the order of your possible enum values:

    View | Edit | Create ( = 7)
    View | Edit          ( = 6)
    View | Create        ( = 5)
    View                 ( = 4)
    Edit | Create        ( = 3)
    Edit                 ( = 2)
    Create               ( = 1)
    None                 ( = 0)
    

    If that ordering fits with your requirements, then your code is correct.

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

Sidebar

Related Questions

I have an enumeration with [Flag] attribute set on it. [Flags] public enum PageTags
Assume i have an enumeration : namespace System.Windows.Forms { public enum DialogResult { None,
I have this enumeration: public enum Translation { English=1, Russian, French, German } I
I have this enumeration: public enum SymbolPair { AUDJPY = 0, AUDNZD, AUDUSD, CADJPY,
I have an enumeration for my Things like so: public enum Things { OneThing,
I have an enum : public enum Enumeration { A, B, C } And
I have one class that declares an enumeration type as: public enum HOME_LOAN_TERMS {FIFTEEN_YEAR,
I have an enumeration that looks like the following public enum MyEnum { A,
I have this enumeration public enum LightFiles { PNG, JPG, GIF, FLV, TIF, BMP,
I have an enumeration: public enum MyColours { Red, Green, Blue, Yellow, Fuchsia, Aqua,

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.