No compilation error when working with structure and properties

Consider the following structure in C #:

public struct TestStruct
{
    public int Number { get; set; }

    public TestStruct(int num)
    {
        Number = num;
    }
}

I am very familiar with the compilation error that occurs if you try to compile this ( this and that the questions give an example).

However, I recently noticed that such a structure compiles fine in Visual Studio 2015.

I was unable to find a changelog for the compiler that would include the above behavior. Can anyone give any guidance as to where to find such information? I found mention of something similar here .

In addition, the CS0188 compiler error page says:

, - .

.

+4
1

# 6 ( , VS2015). . - , , , . .

- # , setter . :

public struct Foo
{
    public string ReadOnlyString { get; }

    public Foo( string prop )
    {
        ReadOnlyString = prop;
    }
}
+4

Source: https://habr.com/ru/post/1668527/


All Articles