473,395 Members | 1,668 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Alternatives to Enum.Parse and Enum.Format

ME
What are the .NET Compact Framework Alternatives to Enum.Parse and
Enum.Format as they are not supported by the Compact Framework?

Thanks,

Matt
Nov 22 '05 #1
4 4874
Use OpenNETCF's SDF. It has the EnumEx class.

www.opennetcf.org/sdf

-Chris

"ME" <tr*********@comcast.netREMOVETHIS> wrote in message
news:K8********************@comcast.com...
What are the .NET Compact Framework Alternatives to Enum.Parse and
Enum.Format as they are not supported by the Compact Framework?

Thanks,

Matt

Nov 22 '05 #2
ME
Thanks,

What about the Enum.Format method? Is there an alternative way to perform
this task:
[Flags]
public enum TypesToCompare
{
none = 0
option1 = 1
option2 = 2
option3 = 4
option4 = 8
}
-----snip------
string enums;
enumTypeToCompare = TypesToCompare.option4 + TypesToCompare.option2

enums = Enum.Format(enumTypeToCompare, TypesToCompare, "f");

the resulting string would yeild:

"4, 2"

Thanks,

Matt

"<ctacke/>" <ctacke_AT_OpenNETCF_com> wrote in message
news:%2******************@TK2MSFTNGP15.phx.gbl...
Use OpenNETCF's SDF. It has the EnumEx class.

www.opennetcf.org/sdf

-Chris

"ME" <tr*********@comcast.netREMOVETHIS> wrote in message
news:K8********************@comcast.com...
What are the .NET Compact Framework Alternatives to Enum.Parse and
Enum.Format as they are not supported by the Compact Framework?

Thanks,

Matt


Nov 22 '05 #3
ME
Sorry, my bad the resulting string would yeild "8, 2"

Thanks,

Matt
"ME" <tr*********@comcast.netREMOVETHIS> wrote in message
news:WM********************@comcast.com...
Thanks,

What about the Enum.Format method? Is there an alternative way to perform
this task:
[Flags]
public enum TypesToCompare
{
none = 0
option1 = 1
option2 = 2
option3 = 4
option4 = 8
}
-----snip------
string enums;
enumTypeToCompare = TypesToCompare.option4 + TypesToCompare.option2

enums = Enum.Format(enumTypeToCompare, TypesToCompare, "f");

the resulting string would yeild:

"4, 2"

Thanks,

Matt

"<ctacke/>" <ctacke_AT_OpenNETCF_com> wrote in message
news:%2******************@TK2MSFTNGP15.phx.gbl...
Use OpenNETCF's SDF. It has the EnumEx class.

www.opennetcf.org/sdf

-Chris

"ME" <tr*********@comcast.netREMOVETHIS> wrote in message
news:K8********************@comcast.com...
What are the .NET Compact Framework Alternatives to Enum.Parse and
Enum.Format as they are not supported by the Compact Framework?

Thanks,

Matt



Nov 22 '05 #4
I'll make a note of a feature request for Format(). One slightly messy way
to do this right now would be to do a tostring which should give you
"option4, option2" then split this and do a Parse on each member, get the
integer value, the reassemble back into a string.

Peter

--
Peter Foot
Windows Embedded MVP
http://www.inthehand.com | http://www.peterfoot.net |
http://www.opennetcf.org

"ME" <tr*********@comcast.netREMOVETHIS> wrote in message
news:ZL********************@comcast.com...
Sorry, my bad the resulting string would yeild "8, 2"

Thanks,

Matt
"ME" <tr*********@comcast.netREMOVETHIS> wrote in message
news:WM********************@comcast.com...
Thanks,

What about the Enum.Format method? Is there an alternative way to
perform this task:
[Flags]
public enum TypesToCompare
{
none = 0
option1 = 1
option2 = 2
option3 = 4
option4 = 8
}
-----snip------
string enums;
enumTypeToCompare = TypesToCompare.option4 + TypesToCompare.option2

enums = Enum.Format(enumTypeToCompare, TypesToCompare, "f");

the resulting string would yeild:

"4, 2"

Thanks,

Matt

"<ctacke/>" <ctacke_AT_OpenNETCF_com> wrote in message
news:%2******************@TK2MSFTNGP15.phx.gbl...
Use OpenNETCF's SDF. It has the EnumEx class.

www.opennetcf.org/sdf

-Chris

"ME" <tr*********@comcast.netREMOVETHIS> wrote in message
news:K8********************@comcast.com...
What are the .NET Compact Framework Alternatives to Enum.Parse and
Enum.Format as they are not supported by the Compact Framework?

Thanks,

Matt



Nov 22 '05 #5

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

Similar topics

4
by: ME | last post by:
What are the .NET Compact Framework Alternatives to Enum.Parse and Enum.Format as they are not supported by the Compact Framework? Thanks, Matt
21
by: Andreas Huber | last post by:
Hi there Spending half an hour searching through the archive I haven't found a rationale for the following behavior. using System; // note the missing Flags attribute enum Color {
1
by: Anonieko Ramos | last post by:
Answer: http://weblogs.asp.net/tims/archive/2004/04/02/106310.aspx by Tim Sneath I've come across the situation on a number of occasions when coding where I've wanted to convert from a string...
8
by: cadilhac | last post by:
Hi, I have the following code: public enum MyColors { Red, Green, Blue } MyColors c = (MyColors)Enum.Parse(typeof(MyColors), "abcd"); Why do I get c = "abcd" after this code instead of...
3
by: giant food | last post by:
This seems like a long shot, but I wondered if there's a way to loop over the values in an Enum. For example, say I have an Enum as follows: Public Enum statusValues Ready Running Finished...
2
by: John A Grandy | last post by:
how to iterate through the members of an Enum ? Enum EnumAction None = 0 Action1 = 1 Action2 = 2 Action3 = 3 Action4 = 4 End Enum
8
by: kc | last post by:
I'm trying to pull data from a database that I have no control over the structure of. There's a members table with a column for the member's sex. It just stores the sex as M or F. I'd like to...
34
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...
5
by: kjqua | last post by:
Hi all, I am newbie in c# and i have a question. I try to work with serial port. and i will like to configure the serial port by a form I add in a ComboBox.parity some items like: None Odd
10
by: Doug | last post by:
I have an enum that will look kind of like this: private enum MyEnum { SomeValue = 0, AnotherValue = 1, ThirdValue = 2 }
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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,...
0
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...

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.