[Mono-list] Use of the {} with arrays
Matt Raffel
matt.raffel at mindspring.com
Wed Sep 6 14:41:42 EDT 2006
Colin JN Breame wrote:
> Hi,
>
> The following compiles and runs fine:
>
> public class test_t {
> public static void Main() {
> System.Console.WriteLine(string.Join(" ", test()));
> }
> public static string[] test() {
> string[] tmp = {"hello", "world"};
> return tmp;
> //return {"hello", "world"};
> }
> }
>
>
changing your return to return new string[] {"hello", "world"}; works.
I doubt the compiler knows that {"hello", "world"} should be a string array.
Matt
More information about the Mono-list
mailing list