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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T03:03:12+00:00 2026-05-31T03:03:12+00:00

Whenever I am debugging a piece of code which involves arrays or lists of

  • 0

Whenever I am debugging a piece of code which involves arrays or lists of ints, doubles, strings, etc/, I prefer printing them over sometimes. What I do for this is write overloaded printArray / printList methods for different types.

for e.g.

I may have these 3 methods for printing arrays of various types

public void printArray(int[] a);

public void printArray(float[] b);

public void printArray(String[] s);

Though this works for me, I still want to know whether it is possible to have a generic method which prints arrays/lists of any types. Can this also be extended to array/list of objects.

  • 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-31T03:03:14+00:00Added an answer on May 31, 2026 at 3:03 am

    There is useful String.Join<T>(string separator, IEnumerable<T> values) method. You can pass array or list or any enumerable collection of any objects since objects will be converted to string by calling .ToString().

    int[] iarr = new int[] {1, 2, 3};
    Console.WriteLine(String.Join("; ", iarr));  // "1; 2; 3"
    string[] sarr = new string[] {"first", "second", "third"};
    Console.WriteLine(String.Join("\n", sarr));  // "first\nsecond\nthird"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Whenever I am debugging a java program, I have to have the code indented!
While debugging, whenever we step into a method, the file which defines that method
When debugging, a trick I do whenever I want to exit the current method
I'm writing an MPI C program. I have troubles debugging it, because whenever I
I'm having some problems debugging my code as I can't work out where an
I have the following annoyance: Whenever I start debugging an XNA game, the game
I'm trying to do a little debugging in my iPhone project, and whenever i
I am debugging a large Makefile-based C project which takes 15 seconds to run
Whenever I stop debugging an ASP.NET IIS web application it seems to take very
I am debugging a program using gdb. Whenever I miss a breakpoint or decide

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.