vendredi 13 juillet 2018

How to check an empty object?

I have a number of objects. Some of them have string properties and some of them have bool properties. I'm using them in multi-step form. so each step is bound to each object.

Now, if the user fills the first two sections and saves the data as a user wants to fill rest of the data later. At this point, I need to identify how much data is filled and how much is left. So that next time when the form gets loaded, based on the previously filled data I can identify from where to start filling the form.

I'm trying to identify at the time of saving that how many objects have values. In other words, if I find an object with all the values e.g. empty strings, I can skip that object to be saved into the database. I referred this https://stackoverflow.com/a/22683141/10037521 which shows how to check empty object which has all the string properties.

How to include boolean properties as well in this check? e.g. If the object has 10 bool properties and if all of them are false, I need to identify that object as empty.

So to summarize above question, how to identify if the object is blank which have bool or string properties?





Aucun commentaire:

Enregistrer un commentaire