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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T01:53:58+00:00 2026-05-30T01:53:58+00:00

After Deserializing a file with just one record It seems that it’s in an

  • 0

After Deserializing a file with just one record

It seems that it’s in an infinitive loop

IndexSeries = (List<string>)bFormatter.Deserialize(fsSeriesIndexGet);
IndexSeries.ForEach(name => AddSerie(name));
//IndexSeries.ForEach(delegate(String name)
//{
      //    AddSerie(name);
//});

AddSerie will be executed infinitively !

  • 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-30T01:53:59+00:00Added an answer on May 30, 2026 at 1:53 am

    If I define:

    //class level declaration (in a console app)
    static List<string> strings;
    
    static void Loop(string s)
    {
      Console.WriteLine(s);
      strings.Add(s + "!");
    }
    

    Then

    static void Main(string[] args)
    {
      strings = new List<string> { "sample" };
      strings.ForEach(s => Console.WriteLine(s));
    }
    

    executes normally, outputing a single string, while

    static void Main(string[] args)
    {
      strings = new List<string> { "sample" };
      strings.ForEach(s => Loop(s));
    }
    

    loops indefinitely, adding ‘!’s in the process, and

    static void Main(string[] args)
    {
      strings = new List<string> { "sample" };
      foreach (string s in strings)
      {
        Loop(s);
      }
    }
    

    throws an InvalidOperationException (Collection was modified; enumeration operation may not execute), which, in my opinion is the correct behavior. Why the List.ForEach method allows the list to be changed by the action, I do not know, but would like to find out 🙂

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

Sidebar

Related Questions

I'm having issues trying to deserializing my xml string that was from a dataset..
When I serialize my LinkedHashMap<String, String> using GSON, I get {b:a,a:1,c:2} and after deserializing
After a small amount of research it seems that TCP MD5 Signatures are enabled
I'm using NetDataContractSerializer . After successfully deserializing an object, is there a way to
After I thought that I've understood how they work, I tried this: NSString *str1
... after having just read http://www.cocoadev.com/index.pl?CocoaInsecurity ... I am curious to know about your
After researching a bit how the different way people slugify titles, I've noticed that
Here's my code: [Serializable()] public class Project { private List<string> _Kinds = new List<string>();
I'm deserialising an XML file which comes from a webservice of one of our
After debugging a CodeIgniter application that were installed into a new development environment, I

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.