473,670 Members | 2,499 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Enum GetValues/GetNames .. is this odd?

It's a time saver to "bind" .Net enums to list and comboboxes and all the
samples out there seem to use GetNames and GetValues pretty interchangeably .

So I was wondering what the logic is to the System.Drawing. RotateFlipType
enumeration.

GetNames and GetValues results don't seem to synch up and binding to
GetValues seems to create duplicates of some elements while"losing" others,
and I haven't seen any mention of why that might be.

To see it just drop a couple of tall listboxes on a form and in the load
add:

ListBox1.DataSo urce = System.Enum.Get Names(GetType(R otateFlipType))
ListBox2.DataSo urce = System.Enum.Get Values(GetType( RotateFlipType) )

Or dump the same to Output:

Dim arValues as String() = System.Enum.Get Values(GetType( RotateFlipType) )
Dim arValues As RotateFlipType( ) =
System.Enum.Get Values(GetType( RotateFlipType) )

For i As Integer = 0 To arNames.Length - 1
Debug.WriteLine (arNames(i) & vbTab & arValues(i).ToS tring)
Next

yields:

Rotate180FlipXY RotateNoneFlipN one
RotateNoneFlipN one RotateNoneFlipN one
Rotate90FlipNon e Rotate270FlipXY
Rotate270FlipXY Rotate270FlipXY
Rotate180FlipNo ne RotateNoneFlipX Y
RotateNoneFlipX Y RotateNoneFlipX Y
Rotate270FlipNo ne Rotate90FlipXY
Rotate90FlipXY Rotate90FlipXY
RotateNoneFlipX Rotate180FlipY
Rotate180FlipY Rotate180FlipY
Rotate90FlipX Rotate270FlipY
Rotate270FlipY Rotate270FlipY
Rotate180FlipX RotateNoneFlipY
RotateNoneFlipY RotateNoneFlipY
Rotate270FlipX Rotate270FlipX
Rotate90FlipY Rotate270FlipX

it's not that there's no one to one relation, but that GetValues returns the
odd duplcate text values. Is it just something about this particular enum
or is this logical and do others that I've not seen yet also do this?

Just wonderin'

smith
kirkland, wa
www.smithvoice.com
Jul 21 '05 #1
2 2831
Ahem, bad paste. Those arrays are of course:

Dim arNames As String() = _
System.Enum.Get Names(GetType(R otateFlipType))

Dim arValues As RotateFlipType( ) = _
System.Enum.Get Values(GetType( RotateFlipType) )

....
For i As Integer = 0 To arNames.Length - 1
Debug.WriteLine (arNames(i) & vbTab & arValues(i).ToS tring)
Next

yields:

Rotate180FlipXY RotateNoneFlipN one
RotateNoneFlipN one RotateNoneFlipN one
Rotate90FlipNon e Rotate270FlipXY
Rotate270FlipXY Rotate270FlipXY
Rotate180FlipNo ne RotateNoneFlipX Y
RotateNoneFlipX Y RotateNoneFlipX Y
Rotate270FlipNo ne Rotate90FlipXY
Rotate90FlipXY Rotate90FlipXY
RotateNoneFlipX Rotate180FlipY
Rotate180FlipY Rotate180FlipY
Rotate90FlipX Rotate270FlipY
Rotate270FlipY Rotate270FlipY
Rotate180FlipX RotateNoneFlipY
RotateNoneFlipY RotateNoneFlipY
Rotate270FlipX Rotate270FlipX
Rotate90FlipY Rotate270FlipX

it's not that there's no one to one relation, but that GetValues returns
the odd duplcate text values. Is it just something about this particular
enum or is this logical and do others that I've not seen yet also do this?

Just wonderin'

smith
kirkland, wa
www.smithvoice.com

Jul 21 '05 #2
Oy. I just didn't wrap my head fully around the degrees and flippage:
http://thedotnet.com/howto/work148254.aspx

Why do we always figure things out just two tries after we've publicly said
that we couldn't do it? And why is it a sliding scale so that you have to
admit it first and only then do the extra tries work?

The rules of this universe were created by a trickster.

smith

"smith" <rc********@smi thvoiceTAKEOUT. com> wrote in message
news:y1******** *********@newsr ead1.news.pas.e arthlink.net...
Ahem, bad paste. Those arrays are of course:

Dim arNames As String() = _
System.Enum.Get Names(GetType(R otateFlipType))

Dim arValues As RotateFlipType( ) = _
System.Enum.Get Values(GetType( RotateFlipType) )

...
For i As Integer = 0 To arNames.Length - 1
Debug.WriteLine (arNames(i) & vbTab & arValues(i).ToS tring)
Next

yields:

Rotate180FlipXY RotateNoneFlipN one
RotateNoneFlipN one RotateNoneFlipN one
Rotate90FlipNon e Rotate270FlipXY
Rotate270FlipXY Rotate270FlipXY
Rotate180FlipNo ne RotateNoneFlipX Y
RotateNoneFlipX Y RotateNoneFlipX Y
Rotate270FlipNo ne Rotate90FlipXY
Rotate90FlipXY Rotate90FlipXY
RotateNoneFlipX Rotate180FlipY
Rotate180FlipY Rotate180FlipY
Rotate90FlipX Rotate270FlipY
Rotate270FlipY Rotate270FlipY
Rotate180FlipX RotateNoneFlipY
RotateNoneFlipY RotateNoneFlipY
Rotate270FlipX Rotate270FlipX
Rotate90FlipY Rotate270FlipX

it's not that there's no one to one relation, but that GetValues returns
the odd duplcate text values. Is it just something about this particular
enum or is this logical and do others that I've not seen yet also do
this?

Just wonderin'

smith
kirkland, wa
www.smithvoice.com


Jul 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2412
by: Daylor | last post by:
Public Enum COLORS RED= 0 GREEN=1 BLUD =2 ORANGE =4
9
1365
by: thechaosengine | last post by:
Hi all, I have a problem that I havent really come accross before. I need to be able to allow the user to set a dropdown control to a particular colour value. The permissable values come from the Color enumeration and unfortunately I can't change this implementation detail. My question is, how can I load the values into the dropdown using the enumeration, and more importantly, when a user selects an entry in the dropdown, how do
3
16060
by: Richard | last post by:
Okay gang, This should be simple but apparently it's not... I want to use the System.DayOfWeek enum to create and access an array of objects with one object for each day of the week. I'd like the array declaration to be strongly typed to the enum and I'd like to use the enum to access entries in the array. I'd like to write code something like this: #using System;
2
6251
by: Armin Bajramovic | last post by:
Hi, I have enum: public enum StatusEnum { Active = 'A', Nonactive = 'N', Deleted = 'D' }
3
36255
by: cyshao | last post by:
Hi ,my friends: I have a enum type ,EMyEnum , defigned as . I just want to do something like this: foreach( EMyEnum crrEnum in EMyEnum ) { //do something }
2
407
by: smith | last post by:
It's a time saver to "bind" .Net enums to list and comboboxes and all the samples out there seem to use GetNames and GetValues pretty interchangeably. So I was wondering what the logic is to the System.Drawing.RotateFlipType enumeration. GetNames and GetValues results don't seem to synch up and binding to GetValues seems to create duplicates of some elements while"losing" others, and I haven't seen any mention of why that might be.
7
9825
by: Harris | last post by:
Dear all, I have the following codes: ====== public enum Enum_Value { Value0 = 0, Value1 = 10,
34
11178
by: Steven Nagy | last post by:
So I was needing some extra power from my enums and implemented the typesafe enum pattern. And it got me to thinking... why should I EVER use standard enums? There's now a nice little code snippet that I wrote today that gives me an instant implementation of the pattern. I could easily just always use such an implementation instead of a standard enum, so I wanted to know what you experts all thought. Is there a case for standard enums?
3
5227
by: shapper | last post by:
Hello, I have an enum: Public Enum Color Red Blue Green End Enum
0
8901
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8813
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8591
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7412
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6212
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4388
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2799
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2037
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1791
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.