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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T19:35:23+00:00 2026-05-23T19:35:23+00:00

I did a test like below ↓ 1) Create a customer enum (copy from

  • 0

I did a test like below ↓

1) Create a customer enum (copy from the dayofweek)

[Serializable]
public enum Tester
{
    // 概要:
    //     Indicates Sunday.
    Sunday = 0,
    //
    // 概要:
    //     Indicates Monday.
    Monday = 1,
    //
    // 概要:
    //     Indicates Tuesday.
    Tuesday = 2,
    //
    // 概要:
    //     Indicates Wednesday.
    Wednesday = 3,
    //
    // 概要:
    //     Indicates Thursday.
    Thursday = 4,
    //
    // 概要:
    //     Indicates Friday.
    Friday = 5,
    //
    // 概要:
    //     Indicates Saturday.
    Saturday = 6,
}

2) Create two test method …

    static void TestEnumToString()
    {
        var t = Tester.Sunday;
        Enumerable.Range(0, 1000000).ToList().ForEach(i => t.ToString());
    }

    static void DayOfWeekEnumToString()
    {
        var t = DayOfWeek.Sunday;
        Enumerable.Range(0, 1000000).ToList().ForEach(i => t.ToString());
    }

3) Main method

    static void Main()
    {
        Stopwatch sw = new Stopwatch();
        sw.Start();
        TestEnumToString();
        sw.Stop();
        Console.WriteLine("Tester:" + sw.ElapsedMilliseconds);


        sw = new Stopwatch();
        sw.Start();
        DayOfWeekEnumToString();
        sw.Stop();
        Console.WriteLine("DayOfWeek:" + sw.ElapsedMilliseconds);

        Console.ReadKey();
    }

4) The result :

Tester : 3164ms
DayOfWeek : 7032ms

I really don’t know why the system type enum is slower than the customer enum type….
Could anybody tell me why ?
Thank you…

UPDATE EDIT:
Add the [ComVisible(true)] to the enum .

[ComVisible(true)]
[Serializable]
public enum Tester
{
    Sunday = 0,


    Monday = 1,


    Tuesday = 2,


    Wednesday = 3,


    Thursday = 4,


    Friday = 5,


    Saturday = 6,
}

The Result :

Tester : 5018ms
DayOfWeek : 7032ms

The system enum type still slower than the customer enum type…

  • 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-23T19:35:24+00:00Added an answer on May 23, 2026 at 7:35 pm

    Enum can be decorate with [ComVisible(true)] or [Flags] and each time it changes the result of your test .

    [Serializable]
    //[Flags]
    [ComVisible(true)]
    public enum Tester
    {    
      // 概要:
      //     Indicates Sunday.
      Sunday = 0,    
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Assume a legacy class and method structure like below public class Foo { public
i simply implemented class that inherits JPanel like below public class Orpanel extends JPanel
I did a test in chrome and firefox, chrome with no extension, firefox with
In an Oracle 10 database, I did a small test: SELECT REGEXP_REPLACE('İF', '[Iİ]F', 'DONE',
There was an interesting question in a practice test that I did not understand
How can I test my site in AOL without installing AOL? I did that
How can one easily test HTTP return codes, like, say, a 301 redirect? For
I would like the ability to have a test ClickOnce server for my applications
So i'm green as grass and learning programming from How to think like a
I am running a basic GWT application in IntelliJ, below is my code public

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.