[Mono-list] Use of the {} with arrays

Colin JN Breame colin at breame.net
Wed Sep 6 14:33:16 EDT 2006


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"};

However, uncommenting the return in test() yields a compile error.  I don't 
have access to an MS compiler so I can't check but I would expect (on grounds 
of logic and consistency ;) it to compile...not that logic and consistency 
have anything to do with it of course...


More information about the Mono-list mailing list