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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T12:56:00+00:00 2026-06-12T12:56:00+00:00

I realize there are no way for me to replace value through LinkedList.Enumerator .

  • 0

I realize there are no way for me to replace value through LinkedList.Enumerator.

For instance, I try to port the below Java code to C#:

Java code:

ListIterator<Double> itr1 = linkedList1.listIterator();
ListIterator<Double> itr2 = linkedList2.listIterator();
while(itr1.hasNext() && itr2.hasNext()){
    Double d = itr1.next() + itr2.next();
    itr1.set(d);
}

C# code:

LinkedList<Double>.Enumerator itr1 = linkedList1.GetEnumerator();            
LinkedList<Double>.Enumerator itr2 = linkedList2.GetEnumerator();

 while(itr1.MoveNext() && itr2.MoveNext()){                
    Double d = itr1.Current + itr2.Current;
    // Opps. Compilation error!
    itr1.Current = d;
}

Any other techniques I can use?

  • 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-06-12T12:56:01+00:00Added an answer on June 12, 2026 at 12:56 pm

    C#’s LinkedList enumerator enumerates the values, not the nodes.

    If you want to modify nodes as in the Java version, I think you have to “enumerate” the nodes manually:

    LinkedListNode<Double> nod1 = linkedList1.First;
    LinkedListNode<Double> nod2 = linkedList2.First;
    while (nod1 != null && nod2 != null)
    {
        Double d = nod1.Value + nod2.Value;              
        nod1.Value = d;
        nod1 = nod1.Next;
        nod2 = nod2.Next;
    } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a way to run a regexp-string replace on the current line in
I realized that ShowHeaderWhenEmpty only works in PostBacks. Is there any way to make
I realize there is a very interesting technique, to get Context in Android in
I realize there are similar questions on this topic, but I still cannot find
I realize there are various kinds of software projects: commercial (for John Doe) industrial
I realize there are a few other questions about why Cygwin is apparently slow,
I realize there are similar posts to this out there, but rest assured, this
I realize there are is no TRIGGER ON SELECT in Postgres. Given a table
I want to store short arrays in a field. (I realize there are reasons
I realize that there are many similar questions, but most involve scaling down the

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.