I'm having problems with arrays in C#
Inside my class when I type in
>>> public static void Main(string[] args) {
Console.WriteLine (new string[] { "I", "Like", "π" });
}
The console says
System.String[]
Instead of the array I pass in.
What I'm trying to do is fit an array into a method like so:
>>> public static void Main(string[] args) {
DoSomething ({ "I", "Like", "π" });
}
>>> public static int DoSomething(string[] array) {
for (int i = 0; i > array.Length; i++) {
Console.WriteLine (array [i]);
}
}
I get an error saying
Unexpected symbol '{' on 'DoSomething ({ "I", "Like", "π" });'
How do I fix these errors?