Primary constructors no longer compile in VS2015

C#Visual Studio-2015C# 6.0

C# Problem Overview


Until this very day, I could make use of primary constructors, such as:

public class Test(string text)
{
    private string mText = text;
}

To be able to do this, in the previous Visual Studio CTP, I had to add this to the csproj-file:

<LangVersion>Experimental</LangVersion>

Anyhow, this no longer works in the Visual Studio 2015 Preview (with or without LangVersion). Does anyone have any ideas about what could be going on?

C# Solutions


Solution 1 - C#

> Does anyone have any ideas about what could be going on?

Yup - primary constructors have been removed from the plans for C# 6. They may well make an appearance in some form in a later version, but they're not in C# 6 any more.

See the "Changes to the language feature set" post from the team for more details.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionMatkoView Question on Stackoverflow
Solution 1 - C#Jon SkeetView Answer on Stackoverflow