mardi 15 octobre 2019

Dinamically select part of object properties

Is there a method to select a part of object properties dinamically ?

I'm on .net Core 3, in a web api project

I need to send to the client a subSet of source properties based on their value

Example 1:

    source = { max="",min="1", label="Code"};
    sendToClient obj should be 
    output = { min="1",label="Code"}

Example 2:

    source = { max="35",min="1", label="MixerColor",width="",height="",rounded=null};
    sendToClient should be 
    output = { max="35",min="1",label="Code"}

if source[prop] Not (null or empty) => send source[prop] to client





Aucun commentaire:

Enregistrer un commentaire