Advertisement

04.03.2008 at 06:40AM PDT, ID: 23292716
[x]
Attachment Details

C#: Is there any way to tell if an enum has explicitly defined values?

Asked by rob263 in .Net Editors & IDEs, Microsoft Visual C#.Net, .NET Framework 3.x versions

Tags: C#, Reflection

I have two enums:

public enum ExplicitValues {A = 0, B = 1, C = 2}
public enum ImplicitValues {A, B, C}

Is there any way I can use reflection to determine that one has explicitly defined values, and the other doesn't?  I've looked through the Enum type and the Reflection library, but couldn't come up with anything.

I'm using .NET 3.5

Thanks.Start Free Trial
 
Keywords: C#: Is there any way to tell if an enu…
 
Loading Advertisement...
 
[+][-]04.03.2008 at 07:45AM PDT, ID: 21273211

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: .Net Editors & IDEs, Microsoft Visual C#.Net, .NET Framework 3.x versions
Tags: C#, Reflection
Sign Up Now!
Solution Provided By: TheLearnedOne
Participating Experts: 3
Solution Grade: B
 
 
[+][-]04.03.2008 at 07:53AM PDT, ID: 21273304

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]04.03.2008 at 07:56AM PDT, ID: 21273339

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]04.03.2008 at 09:03AM PDT, ID: 21273987

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_EXPERT_20070906