且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在 C# 中获取类中字段的默认值?

更新时间:2022-12-04 22:17:48

简短的回答:你不能.

如果您实现某种自定义事务系统,那是可能的.开箱即用:没有运气.

If you implement some kind of custom transactional system, than it is possible. Out of the box: no luck.

是的,自定义事务系统可以非常简单:添加另一个用于记住"初始值的字段或属性.

And yes, the custom transactional system can be very simple: add another field or property that you use to 'remember' the initial value.