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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T08:38:00+00:00 2026-05-12T08:38:00+00:00

I have the following enum –> public enum SyncStatus { Unavailable = 0, Checking

  • 0

I have the following enum –>

    public enum SyncStatus
    {
        Unavailable = 0,
        Checking = 5,
        StartedAspNetDb = 10,
        FinishedAspNetDb = 20,
        StartedMatrixDb = 30,
        FinishedMatrixDb = 40,
        StartedConnectDb = 50,
        FinishedConnectDb = 60,
        StartedCmoDb = 70,
        FinishedCmoDb = 80,
        StartedMcpDb = 90,
        FinishedMcpDb = 100
    }

Which I use here –>

        SyncInBackground.ReportProgress(SyncStatus.StartedAspNetDb);
        MergeRepl aspnetdbMergeRepl = new MergeRepl(SystemInformation.ComputerName + "\\SQLEXPRESS", "WWCSTAGE", "aspnetdb", "aspnetdb", "aspnetdb");
        aspnetdbMergeRepl.RunDataSync();
        SyncInBackground.ReportProgress(SyncStatus.FinishedAspNetDb);

        SyncInBackground.ReportProgress(SyncStatus.StartedMatrixDb);
        MergeRepl matrixMergeRepl = new MergeRepl(SystemInformation.ComputerName + "\\SQLEXPRESS", "WWCSTAGE", "MATRIX", "MATRIX", "MATRIX");
        matrixMergeRepl.RunDataSync();
        SyncInBackground.ReportProgress(SyncStatus.FinishedMatrixDb);

        SyncInBackground.ReportProgress(SyncStatus.StartedConnectDb);
        MergeRepl connectMergeRepl = new MergeRepl(SystemInformation.ComputerName + "\\SQLEXPRESS", "WWCSTAGE", "CONNECT", "Connect", "Connect");
        connectMergeRepl.RunDataSync();
        SyncInBackground.ReportProgress(SyncStatus.FinishedConnectDb); 

What I don’t understand is why, if int is default enum governing type, do I have to CAST this line, like so –>

 SyncInBackground.ReportProgress((int)SyncStatus.Checking);

Forgive my ignorance I just like to understand the why of things not just that they are so.

  • 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-12T08:38:00+00:00Added an answer on May 12, 2026 at 8:38 am

    There just isn’t an implicit conversion from an enum type to its underlying type. This makes it harder to accidentally use an enum as its numeric value.

    (There’s likewise no conversion the other way.)

    There is an implicit conversion from the constant 0 to any enum type, by the way.

    Oh, and unboxing from a boxed enum value to its underlying type – or vice versa – works too. At least at one point this was really badly mangled in both the CLI spec and the C# spec; it may well have been fixed by now 🙂

    EDIT:

    Here’s an alternative option if you actually just want to use the values as numbers:

    public static class SyncStatus
    {
        public const int Unavailable = 0;
        public const int Checking = 5;
        public const int StartedAspNetDb = 10;
        public const int FinishedAspNetDb = 20;
        public const int StartedMatrixDb = 30;
        public const int FinishedMatrixDb = 40;
        public const int StartedConnectDb = 50;
        public const int FinishedConnectDb = 60;
        public const int StartedCmoDb = 70;
        public const int FinishedCmoDb = 80;
        public const int StartedMcpDb = 90;
        public const int FinishedMcpDb = 100;
    }
    

    Alternatively, write a method like this:

    static void ReportProgress(SyncStatus status)
    {
        SyncInBackground.ReportProgress((int) status);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 216k
  • Answers 216k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer -[NSArray subarrayWithRange:] Reference: https://developer.apple.com/documentation/foundation/nsarray/1415157-subarraywithrange May 12, 2026 at 11:05 pm
  • Editorial Team
    Editorial Team added an answer If the words are space-separated: NSInteger nWords = 10; NSRange… May 12, 2026 at 11:05 pm
  • Editorial Team
    Editorial Team added an answer I would create a new Layered Window at the mouse… May 12, 2026 at 11:05 pm

Related Questions

I have the following enum declared: public enum TransactionTypeCode { Shipment = 'S', Receipt
I have the following enum: public enum Status implements StringEnum{ ONLINE(on),OFFLINE(off); private String status
I have the following Enum: Public Enum myEnum As Integer first = &H1 second
I have the following enum --> public enum SyncStatus { Unavailable = 0, Checking
I have the following enum how do i map in jna ?? This enum

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.