Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Print the contents of an array (code is one line, for use in Immediate window of visual studio)

Can you write a convenient line of code that prints the contents of an array?

I will use this in the Immediate Window of Visual Studio 2008, so really it has to work in that window. I may have left out some requirements, but that's pretty much what I'm trying to do.

like image 287
MedicineMan Avatar asked Sep 11 '25 04:09

MedicineMan


2 Answers

myArray.ToList().ForEach(Console.WriteLine);

Honestly though, I don't think that'll work in the immediate window. It is a nice trick to print it all in one line, but I think for the immediate window, all you need is this:

? myArray
like image 190
BFree Avatar answered Sep 12 '25 18:09

BFree


I use:

BitConverter.ToString(bytes); //output: 4A-0B-11-13  etc.

Poor BitConverter, always forgotten.

like image 42
Ben Lesh Avatar answered Sep 12 '25 18:09

Ben Lesh