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 7865373
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T00:04:06+00:00 2026-06-03T00:04:06+00:00

I have an enum (let’s say DemoEnum) and I want to parse a value

  • 0

I have an enum (let’s say DemoEnum) and I want to parse a value to this enum. I am writing

DemoEnum value;
if(DemoEnum.TryParse("input", out value))
{
   this.Value = value;
}

Now the resharper suggests me, to use the base class qualifier.

I just want to know what’s the benefit of using the base class qualifier?

  • 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-03T00:04:07+00:00Added an answer on June 3, 2026 at 12:04 am

    Generally, it is a good idea to use the most generic solution possible.

    DemoEnum.TryParse("input", out value)
    

    Is the same call as (you’re just making the static call from an inherited class rather than the base class):

    Enum.TryParse<DemoEnum>("input", out value)
    

    Using the base class qualifier (Enum) instead of your specific enum (DemoEnum) would insulate you from possible side effects of changing DemoEnum in the future. The reality is that you’re really only going to run into issues if you change DemoEnum to a class without changing the name.

    This is generally a larger issue when using classes (and ReSharper will give the same guidance in those situations).

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

Sidebar

Related Questions

Let's say I have this enum: [Flags] enum Letters { A = 1, B
Let's say you have an enum like this: public enum ColorsEnum { Undefined, Blue,
Let's say I have this class: public class SiteMapEntry { public static enum ChangeFrequency
Let's say I have an interface ICustomerService and this interface requires an enum, e.g.
Let's say I have this enum: [Flags] public enum SomeType { Val1 = 0,
Let's say I have an enum like this: [Flags] public enum NotificationMethodType { Email
I have a enum let's say enum MyEnum { FirstImage, SecondImage, ThirdImage, FourthImage };
Let's say I have a class that looks something like this: class Foo(Prop1:Int, Prop2:Int,
Let's say we have an array of PRINTER_INFO_2 like this: PRINTER_INFO_2* printers = (PRINTER_INFO_2*)malloc(sizeof(PRINTER_INFO_2)
Given this enum: public enum FileTypes { FILEA, FILEB, FILEC; } Say you want

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.