PC Review


Reply
Thread Tools Rate Thread

Alternatives to Enum.Parse and Enum.Format

 
 
ME
Guest
Posts: n/a
 
      18th May 2005
What are the .NET Compact Framework Alternatives to Enum.Parse and
Enum.Format as they are not supported by the Compact Framework?

Thanks,

Matt


 
Reply With Quote
 
 
 
 
Guest
Posts: n/a
 
      18th May 2005
Use OpenNETCF's SDF. It has the EnumEx class.

www.opennetcf.org/sdf

-Chris



"ME" <(E-Mail Removed)> wrote in message
news:K8-dnf3Sl9EVIRffRVn-(E-Mail Removed)...
> What are the .NET Compact Framework Alternatives to Enum.Parse and
> Enum.Format as they are not supported by the Compact Framework?
>
> Thanks,
>
> Matt
>



 
Reply With Quote
 
ME
Guest
Posts: n/a
 
      18th May 2005
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:%23Y%(E-Mail Removed)...
> Use OpenNETCF's SDF. It has the EnumEx class.
>
> www.opennetcf.org/sdf
>
> -Chris
>
>
>
> "ME" <(E-Mail Removed)> wrote in message
> news:K8-dnf3Sl9EVIRffRVn-(E-Mail Removed)...
>> What are the .NET Compact Framework Alternatives to Enum.Parse and
>> Enum.Format as they are not supported by the Compact Framework?
>>
>> Thanks,
>>
>> Matt
>>

>
>



 
Reply With Quote
 
ME
Guest
Posts: n/a
 
      18th May 2005
Sorry, my bad the resulting string would yeild "8, 2"

Thanks,

Matt
"ME" <(E-Mail Removed)> wrote in message
news:WMGdnajREO_mXxffRVn-(E-Mail Removed)...
> 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:%23Y%(E-Mail Removed)...
>> Use OpenNETCF's SDF. It has the EnumEx class.
>>
>> www.opennetcf.org/sdf
>>
>> -Chris
>>
>>
>>
>> "ME" <(E-Mail Removed)> wrote in message
>> news:K8-dnf3Sl9EVIRffRVn-(E-Mail Removed)...
>>> What are the .NET Compact Framework Alternatives to Enum.Parse and
>>> Enum.Format as they are not supported by the Compact Framework?
>>>
>>> Thanks,
>>>
>>> Matt
>>>

>>
>>

>
>



 
Reply With Quote
 
Peter Foot [MVP]
Guest
Posts: n/a
 
      18th May 2005
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" <(E-Mail Removed)> wrote in message
news:ZLydne8HE5kgXxffRVn-(E-Mail Removed)...
> Sorry, my bad the resulting string would yeild "8, 2"
>
> Thanks,
>
> Matt
> "ME" <(E-Mail Removed)> wrote in message
> news:WMGdnajREO_mXxffRVn-(E-Mail Removed)...
>> 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:%23Y%(E-Mail Removed)...
>>> Use OpenNETCF's SDF. It has the EnumEx class.
>>>
>>> www.opennetcf.org/sdf
>>>
>>> -Chris
>>>
>>>
>>>
>>> "ME" <(E-Mail Removed)> wrote in message
>>> news:K8-dnf3Sl9EVIRffRVn-(E-Mail Removed)...
>>>> What are the .NET Compact Framework Alternatives to Enum.Parse and
>>>> Enum.Format as they are not supported by the Compact Framework?
>>>>
>>>> Thanks,
>>>>
>>>> Matt
>>>>
>>>
>>>

>>
>>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to parse an Enum Structure in vb.net Herfried K. Wagner [MVP] Microsoft VB .NET 6 6th Jul 2006 12:14 AM
Enum.Parse() John A Grandy Microsoft C# .NET 3 7th Apr 2006 11:06 PM
Alternatives to Enum.Parse and Enum.Format ME Microsoft Dot NET 4 18th May 2005 10:07 AM
Enum.Parse() in CF Yechezkal Gutfreund Microsoft Dot NET Compact Framework 1 13th Nov 2003 09:50 PM
Enum.Parse Erdem ALKILIÇGiL Microsoft Dot NET Compact Framework 1 25th Jul 2003 11:40 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:29 AM.