Why property is public and the setter is private

I saw this example on some website:

public class infoData
    public FridgeProduct fridgeProduct { get; private set; }

What is the point to do private setter if fridgeProduct field is defined as public and can be accessed by definition from any other class?


The private setter has the effect that the property can be written to only from within the class, not from outside.

Note that the access specification (private) on the set accessor overrides the access specification (public) of the property. As Aluan Haddad noted in the comments, the compiler enforces that the accessibility of an individual accessor cannot be less restrictive than the accessibility of the property itself.