Using C#
Im using web api method webmethod1 to return a list of a POCO class pcl1 with 10 members. I also have webmethod2 which returns a shortened version of pcl1. By shortened I mean I deliberately populate just 3 members of that class.
Because of large numbers of records returned I would like to slightly improve the performance by ignoring null value members in my POCO class. Of course I could create a 2nd POCO class and in my code loop thorugh thr result and cast it and so on but I thought I'd explore this dunamic Ignore if null option if available. Also I can't use [Ignore if null] attribute on my 10-member POCO class.
So is there a way to dynamically ignore null values when compiling JSON result ?