Is it a breaking change that modifying the access modifier of a public property?

前端 未结 5 840
太阳男子
太阳男子 2021-02-01 05:22

If I change the access modifier of the setter of a public property from private to public, is that causes any breaking change in the other assemblies that refer it?

5条回答
  •  广开言路
    2021-02-01 06:12

    Since the visibility of the property is increased now there should not be any problems with statically linked assemblies and static references -- those assemblies just treated your property as read-only until now and they continue doing so.

    The only problem that might potentially arise here is if some assemblies use reflection to get information about your properties and perform some actions.

    For example, if this is a property of a business object and you use data binding to show your data in some control, like GridView or ListView (independent from the actual framework), it might be that this property will be recognized as "updateable" now and the user might change some values you (and some other assemblies) considered immutable so far.

提交回复
热议问题