You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sometimes i want get object with clone only public property and field. But some property can be set in constructor, like this:
class MyClass
{
private Dictionary<int, string> _myPrivate
public MyClass()
{
_myPrivate = new Dictionary<int, string>();
}
}
I think you can use new clone strategy with Expression.New() and foreach on public property/field, for generate clone func.
If class have no empty ctor, cloner can return Exception.
Yep. I think if you want clone only public properties/fields you need create object with constructor. It can be contract for this mode. Or do something with initialize private field from constructor.
This issue is a followup on @IgorMamushin's feature request in #3.
As far as I understand the request is about adding an option for not cloning private fields.
The text was updated successfully, but these errors were encountered: