This project is read-only.
1

Resolved

VS2014 CTP3, Roslyn, Dictionary Initializer feature does not work.

description

I have installed VS2014 CTP3, and trying to explore the C#6 language features.

Also installed Roslyn by nuget command - "Install-Package "Microsoft.CodeAnalysis" -Pre"

when I tried to explore "Dictionary Initializer" feature similar to the samples provided (shown in below code), I get compilation errors. Other features like null propagation, primary constructors, etc work fine.

Am I missing something? Do I need to install anything else?
       public static JArray ToJson(IEnumerable<Point> points)
        {
            return new JArray(
                from p in points
                where p != null
                select new JObject() { ["x"] = p.X, ["y"] = p.Y}
            );
        }
      OR
      var numbers = new Dictionary<int, string> { [7] = "seven", [9] = "nine", [13] = "thirteen" };

comments

VSadov wrote Oct 30, 2014 at 11:32 PM

This is expected since CTP3 was published before this feature was added.
It should work in CTP4.