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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T04:02:35+00:00 2026-05-14T04:02:35+00:00

if ConvertAll throw an exception on one element, can i just skip this element

  • 0

if ConvertAll throw an exception on one element, can i just skip this element and continue to the next element?

  • 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-14T04:02:36+00:00Added an answer on May 14, 2026 at 4:02 am

    No. The exception will need to be handled somewhere. If you expect exceptions to happen in the converter (and this is OK for the application), you must have a try-catch within the converter (the following code sample will return null for failed conversions):

    List<string> input = new List<string> { "1", "2", "three", "4" };
    
    List<int?> converted = input.ConvertAll(s =>
    {
        int? result = null;
        try
        {
            result = int.Parse(s);
        }
        catch (Exception) { }
    
        return result;
    });
    

    (yes, I know I should have used int.TryParse, but that would not throw an exception…)

    However, eating exceptions like that always gives the smell of a workaround, and is nothing I would like to have in my code.

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

Sidebar

Related Questions

I want to do this: MethodInfo m = myList.GetType().GetMethod(ConvertAll, System.Reflection.BindingFlags.InvokeMethod).MakeGenericMethod(typeof(object)); List<object> myConvertedList = (List<object>)m.Invoke(myList,
It seems UITextFields convert all non-breaking spaces (nbsp, U+00A0) to spaces (U+0020). This causes
I have this function I am using to decrypt values that works fine on
I'm using process.Start to run Convert.exe. This program's purpose is to convert all files
I am trying to convert all DateTime values in a DataTable to strings. Here
I'm trying to convert all instances of the > character to its HTML entity
I need to use sed to convert all occurences of ##XXX## to ${XXX} .
I am consuming the Twitter API and want to convert all URLs to hyperlinks.
I have a list of integers, List<Integer> and I'd like to convert all the
There is a try-catch thing about functions, which I think sometimes may be quite

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.