Intermediate C#
Q59 / 100

What is the init accessor in C# 9?

Correct! Well done.

Incorrect.

The correct answer is B) A property accessor that allows setting only during object initialization, making the property effectively immutable afterward

B

Correct Answer

A property accessor that allows setting only during object initialization, making the property effectively immutable afterward

Explanation

public string Name { get; init; } can be set in object initializers (new Person { Name = "Alice" }) but not after the object is constructed.

Progress
59/100