jeudi 18 juin 2020

Instead of using reflection to loop though a class properties, can i serialize it to json string and look through it? Are there any downsides to it?

Assume I have a class as below

class Student
{
    public int ID { get; set; }

    public string Name { get; set; }
}

Just with 0 more properties.I want to loop through these properties. I can do it through reflection, which will have a performance cost. Is serializing it using Newtonsoft JSON and looping through it better?





Aucun commentaire:

Enregistrer un commentaire