I have a REST API for exposing quote data. Sometimes API can take specific parameters to provide data for.
General usage: http://blah.com/quotes?symbol=MSFT
specific usage: http://blah.com/quotes?symbol=MSFT¶ms=[Symbol,Sector,Industry]
DTO:
public class QuoteDto
{
public string CompanyName { get; private set; }
public string Symbol { get; private set; }
public string Exchange { get; private set; }
public string Sector { get; private set; }
public string Industry { get; private set; }
. . .
}
during general usage i simply serialize my DTO into Json. But when i get specific request how can i filter out unwanted params from my dto before i serialize ??
is there any third party lib to do this? I can use reflection but thats way to wonky. I am using ASP.NET MVC and C#