Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5928311
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T14:16:39+00:00 2026-05-22T14:16:39+00:00

I am working with C++ and .NET 1.1, and need to parse String values

  • 0

I am working with C++ and .NET 1.1, and need to parse String values into their corresponding int values from an enumerator.

I have an enumerator

__value static enum myEnum {
  VALUE1,
  VALUE2,
  VALUE3
};

and I am trying to do something along the lines of

int value = (int)Enum::Parse(__typeof(myEnum), stringToParse);

or

int value = (myEnum)Enum::Parse(__typeof(myEnum), stringToParse);

except of course that Enum::Parse returns an Object*, and I just can’t work out how to cast that object into an int.

What am I doing wrong? (Something to do with managed extensions, like last time I got stuck?)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T14:16:40+00:00Added an answer on May 22, 2026 at 2:16 pm

    It should just be an unbox – although you might want to unbox to the enum and then cast. In C#, something like;

    int value = (int)(myEnum)Enum.Parse(typeof(myEnum), stringToParse);
    

    Not sure what that looks like in C++ though.

    In C# the following also works, but I can’t guarantee how formally:

    int value = (int)Enum.Parse(typeof(myEnum), stringToParse);
    

    Note in the above I’m assuming that myEnum is using Int32 as the underlying type. If that is not the case, then you need tweak it to unbox as the correct underlying type first.

    Running it through reflector, I get:

     Int32 __gc* value = *static_cast<__box Int32*>(
       *static_cast<__box myEnum*>(Enum::Parse(__typeof(myEnum), stringToParse)));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on a ASP.NET app and i have a need to post
I'm working on an ASP.NET/C# app. I have 2 text boxes and I need
im working on a documentation project and i need to parse the .net framework
My Scenario, Im working asp.net vb application I have set of values to be
I am working with ASP.NET and need to manage with a string typed by
I'm working on an asp.net application which uses Lucene.net I need to highlight the
I'm working with a intranet website written in ASP.NET and need to be able
I'm working in a .net application where we need to generate XML files on
I am working with asp.net website project that some of pages need authentication. I
I'm working with C#.net developing applications for windows mobile 6, and i need get

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.