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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T20:44:18+00:00 2026-05-10T20:44:18+00:00

In vs2008, is it possible to write an extension methods which would apply to

  • 0

In vs2008, is it possible to write an extension methods which would apply to any enumeration.

I know you can write extension methods against a specific enumeration, but I want to be able to every enumeration using a single extension method. Is this possible?

  • 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. 2026-05-10T20:44:19+00:00Added an answer on May 10, 2026 at 8:44 pm

    Yes, just code against the base Enum type, e.g.

    public static void Something(this Enum e) {     // code here } 

    The down-side is you’ll probably end up doing some quite nasty stuff like finding the real base type using Enum.GetUnderlyingType, casting, and going down different branches depending on what the base type of the enum is, but you can find some good uses for it (e.g. we have IsOneOf and IsCombinationOf methods that apply to all enums).

    PS: Remember when writing the method that, although ill advised, you can use float and double as the base types for enums so you’ll need some special cases for those as well as unsigned values.

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

Sidebar

Ask A Question

Stats

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

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

    • 7 Answers
  • Editorial Team

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

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer The iPhone OS document sets are definitely available in the… May 11, 2026 at 12:01 pm
  • added an answer Steve Sanderson blogged about using partial requests in ASP.NET MVC,… May 11, 2026 at 12:01 pm
  • added an answer Try: GEvent.addListener(map, 'maptypechanged', function() { var newMapType = map.getCurrentMapType(); //… May 11, 2026 at 12:01 pm

Related Questions

In vs2008, is it possible to write an extension methods which would apply to
is it possible to hide/block files/folders in a VS2008 solution from various users (by
In VS2005 and up, is it possible to specify which configuration should be selected
When editing XAML in VS2008 SP1, the editor is really slow. devenv process seems
I'm trying to use a class within a T4 template in VS2008. Here is
This is probably a no brainer but... I've just opened a solution in VS2008
Once I've created a variable in the immediate window in C# (VS2008), is there
The coding is done using VS2008 There are two divs in my page namely
I created an Interop user control in VS2005. When the user control is shown
Is there anyway to build a solution to target 64 bit environment in vs2003?

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.