473,804 Members | 2,265 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 4909
Use OpenNETCF's SDF. It has the EnumEx class.

www.opennetcf.org/sdf

-Chris

"ME" <tr*********@co mcast.netREMOVE THIS> wrote in message
news:K8******** ************@co mcast.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;
enumTypeToCompa re = TypesToCompare. option4 + TypesToCompare. option2

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

the resulting string would yeild:

"4, 2"

Thanks,

Matt

"<ctacke/>" <ctacke_AT_Open NETCF_com> wrote in message
news:%2******** **********@TK2M SFTNGP15.phx.gb l...
Use OpenNETCF's SDF. It has the EnumEx class.

www.opennetcf.org/sdf

-Chris

"ME" <tr*********@co mcast.netREMOVE THIS> wrote in message
news:K8******** ************@co mcast.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*********@co mcast.netREMOVE THIS> wrote in message
news:WM******** ************@co mcast.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;
enumTypeToCompa re = TypesToCompare. option4 + TypesToCompare. option2

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

the resulting string would yeild:

"4, 2"

Thanks,

Matt

"<ctacke/>" <ctacke_AT_Open NETCF_com> wrote in message
news:%2******** **********@TK2M SFTNGP15.phx.gb l...
Use OpenNETCF's SDF. It has the EnumEx class.

www.opennetcf.org/sdf

-Chris

"ME" <tr*********@co mcast.netREMOVE THIS> wrote in message
news:K8******** ************@co mcast.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*********@co mcast.netREMOVE THIS> wrote in message
news:ZL******** ************@co mcast.com...
Sorry, my bad the resulting string would yeild "8, 2"

Thanks,

Matt
"ME" <tr*********@co mcast.netREMOVE THIS> wrote in message
news:WM******** ************@co mcast.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;
enumTypeToCompa re = TypesToCompare. option4 + TypesToCompare. option2

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

the resulting string would yeild:

"4, 2"

Thanks,

Matt

"<ctacke/>" <ctacke_AT_Open NETCF_com> wrote in message
news:%2******** **********@TK2M SFTNGP15.phx.gb l...
Use OpenNETCF's SDF. It has the EnumEx class.

www.opennetcf.org/sdf

-Chris

"ME" <tr*********@co mcast.netREMOVE THIS> wrote in message
news:K8******** ************@co mcast.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
369
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
4610
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
375
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 to an enum. In the Media Catalog sample, I resorted to one giant switch statement that has a case block for each string that returns an enum from it. One of my colleagues came up with the answer yesterday; it's one of
8
6344
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 getting a ArgumentException ? MSDN says that this expetion is triggered when value is a name, but not
3
15110
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 Error End Enum
2
362
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
8618
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 create an enum to store the sex. Is there a way that I can create a method in the Enum to convert M to Male and F to Female, or does this method have to exist in another class? Thanks for any help!
34
11210
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?
5
7650
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
6138
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
9714
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10346
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
10347
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
9173
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...
0
6863
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5531
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4308
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
3832
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3001
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.