Search code examples
c#c#-6.0primary-constructor

Primary Constructor is not being compiled in C# 6.0


I am trying to write a simple example of the Primary Constructor new feature in C# 6.0 but I am not able to compile it. I have changed the Language version to c# 6.0 but it still doesn't work.

enter image description here

public class Person (string fName, string lName)
{
    public string FName { get; private set; } = fName;
    public string LName { get; private set; } = lName;
}

How can I make it compile?


Solution

  • I am trying to write a simple example of the Primary Constructor new feature in C# 6.0 but I am not able to compile it. I have changed the Language version to c# 6.0 but it still doesn't work.

    That feature was cut.