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 746843
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T14:08:13+00:00 2026-05-14T14:08:13+00:00

I am porting a library from C++ to C#. The old library uses vectors

  • 0

I am porting a library from C++ to C#. The old library uses vectors from C++ and in the C# I am using generic Dictionaries because they’re actually a good data structure for what I’m doing (each element has an ID, then I just use using TypeDictionary = Dictionary<String, Type>;). Now, in the C# code I use a loop like this one

TypeDictionary.Enumerator tdEnum = MyTypeDictionary.GetEnumerator();

while( tdEnum.MoveNext() ) 
{
   Type element = typeElement.Current.Value;

   // More code here
}

to iterate through the elements of the collection. The problem is that in particular cases I need to check if a certain enumerator has reached the end of the collection, in C++ I would have done a check like this:

if ( tdEnum == MyTypeDictionary.end() ) // More code here

But I just don’t know how to handle this situation in C#, any ideas?

Thank you
Tommaso

  • 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-14T14:08:14+00:00Added an answer on May 14, 2026 at 2:08 pm

    Here’s a pretty simple way of accomplishing this.

    bool hasNext = tdEnum.MoveNext();
    while (hasNext) {
        int i = tdEnum.Current;
        hasNext = tdEnum.MoveNext();
    }
    

    I found an online tutorial that also may help you understand how this works.

    http://www.c-sharpcorner.com/UploadFile/prasadh/Enumerators11132005232321PM/Enumerators.aspx

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm porting a UT3 game to UDK . It uses a large code library
I'm porting a library from char to TCHAR. the count parameter of this fragment,
I am porting visual c++ 6 application to python using ctypes. It uses same
In the process of porting some of my generic class libraries from C++ to
I'm porting some obscure library from autotools to cmake. The library in question compiles
I'm in the process of porting a C++ library from Linux to Windows, and
I'm porting a library of image manipulation routines into C from Java and I'm
I'm porting some code from one framework library to another, which requires me to
I am porting an application from Tru64 to Linux and it uses PID_MAX defined
I'm porting a library from Windows to *NIX (currently OSX), does anyone now what

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.