I'm in need of assistance figuring out how to accomplish the following task:
Below is the code snippet I am working with:
public class Data
{
public string FirstName;
public string LastName;
public int Age;
}
var data = new Data
{
//this object is filled from the data i retrieve from a database.
}).ToList();
var json = new JavaScriptSerializer().Serialize(data);
return json;
Up to this point, I can display the data on my UI using the information stored in the "json" variable.
Now, I am looking to filter certain members of the object and only return those to the UI. To achieve this, I have a mapping XML file that looks like this:
<?xml version="1.0" encoding="utf-8" ?>
<Items>
<FirstName return="True"/>
<LastName return="False"/>
<Age return="True"/>
</Items>
I am querying the XML file to create a list of items that need to be filtered. Based on this list, I want to filter the "object" mentioned above and pass the filtered data to the UI.
I am seeking guidance on how to accomplish the above task.