Answers for "print array in c#"

C#
8

C# print array

string[] myArray = {"Dogs", "Cats", "Birds"};
foreach (string item in myArray)
{
  Console.WriteLine(item);
}
Posted by: Guest on March-28-2020
2

print array in c#

Console.WriteLine(string.Join("\n", myArrayOfObjects));
Posted by: Guest on January-18-2021
4

print content of array c#

//array of numbers, it works with strings also
int numbers[3] = {1, 4, 5, 6}

/*declares int named 'number' and assigns it the value of an index
starting from index 0 to the end of the array, in this case, 3*/
foreach(int number in numbers){
  //prints the number
  Console.WriteLine(number);
}
Posted by: Guest on March-30-2020

C# Answers by Framework

Browse Popular Code Answers by Language