Avatar of Michael Sterling
Michael Sterling
Flag for United States of America asked on

Serialize, then deserialize, vs. deserialize, then serialize: Which order and why?

Working for a new company and I'm learning how they do what they do and why they do it. I've noticed that when setting u the sorting for their grids, they sometimes DE-serialize then serialize, and sometimes they do the opposite. I have done sorting on grids before in C# but have not had to use serialization or DE-serialization so, I'm just trying to get a better understanding of when and why you would want to use this technique? If a brief summary of this can be given that will suffice, otherwise some links on why and why the order matters would be great. Thanks in advance.
ASP.NET.NET ProgrammingC#

Avatar of undefined
Last Comment
Michael Sterling

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
it_saige

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
AndyAinscow

I don't see why that should have anything to do with sorting.
it_saige

Neither do I Andy, but you never can tell, what if they sort in the db query rather than in the ui (silly, I know but stranger things have happened)...  ;)

-saige-
AndyAinscow

Sorting in the DB query itself makes perfect sense.  DB's can index fields and sorting on an indexed field is very efficient (unlike sorting on unindexed fields).  But the DB drivers should take care of the grunt working in making any data available to the app in a suitable format.
Your help has saved me hundreds of hours of internet surfing.
fblack61
SOLUTION
Kyle Abrahams

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Michael Sterling

ASKER
I think I'm gonna close this question as I've gotten some good feedback, and thank you in advance to those who contributed. What I noticed (to your points Kyle & it_saige), is that, in the example that I've been given to model from, they are De-serializing the data into an object, and then, after sorting they serialize and put the same data into a session variable before continuing on to determine which direction to sort the column that has been clicked etc. So, Kyle/it_saige, by your explanation(s) above, they unpacked it into an object first, but then packed it [in]to a session variable which is "sending" the data to a different [storage] location. The utility that pulls the data is from a data access layer which, in this case,  is definitely a separate application domain. Would that be an accurate way to apply your explanation?
SOLUTION
it_saige

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
SOLUTION
Kyle Abrahams

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Michael Sterling

ASKER
Thanks to all who contributed.