Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can we have a attribute to ignore some field/property? #7

Closed
sd016808 opened this issue Sep 27, 2018 · 6 comments
Closed

Can we have a attribute to ignore some field/property? #7

sd016808 opened this issue Sep 27, 2018 · 6 comments

Comments

@sd016808
Copy link

I have a class which implemented INotifyPropertyChanged interface.

How can I use deepClone without some property( PropertyChanged event )?

I have tried [field: NonSerialized] and [JsonIgnore], but it still clone the PropertyChanged event.

@force-net
Copy link
Owner

Currently it does not supported by idea of library: "Cloned objects should be same as original and it should not know, that it cloned".
May be, in future, I'll add support of attributes, but it hard due current optimizations which can clone object with it fields in one step.

@sd016808
Copy link
Author

I am looking forward to this feature implementation!

I use the MVVM pattern, and most of my classes have implemented INotifyPropertyChanged interface.

If I use deepClone with event/delegate, I will got some memory error and crash problem.

@Rsverma
Copy link

Rsverma commented Dec 4, 2018

Having the same issue. Trying to clone an item from grid results in cloning the entire grid internally due to this PropertyChanged Binding.

@force-net
Copy link
Owner

Ok. I'll think, how to better implement such functionality (add some helper function to exclude/override cloning, or attribute, or something else, or all variants).

@Rsverma
Copy link

Rsverma commented Dec 6, 2018

It seems an attribute would be the best way to go(if possible) such as the NonSerializedAttribute which prohibits serialization of a field.

@GF-Huang
Copy link

Any progress?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants