A generic Re-usable C# Property Parser utility

Posted by Shyam K Pananghat on Stack Overflow See other posts from Stack Overflow or by Shyam K Pananghat
Published on 2013-07-01T04:18:44Z Indexed on 2013/07/01 4:20 UTC
Read the original article Hit count: 120

Filed under:
|
|
|

This is about a utility i have happened to write which can parse through the properties of a data contracts at runtime using reflection. The input required is a look like XPath string. since this is using reflection, you dont have to add the reference to any of your data contracts thus making pure generic and re- usable.. you can read about this and get the full c# sourcecode here. Property-Parser-A-C-utility-to-retrieve-values-from-any-Net-Data-contracts-at-runtime

Now about the doubts which i have about this utility. i am using this utility enormously i many places of my code

  1. I am using Regex repetedly inside a recursion method. does this affect the memmory usage or GC collection badly ?do i have to dispose this manually. if yes how ?.
  2. The statements like obj.GetType().GetProperty() and obj.GetType().GetField() returns .net "object" which makes difficult or imposible to introduce generics here. Does this cause to have any overheads like boxing ?

on an overall, please suggest to make this utility performance efficient and more light weight on memmory

© Stack Overflow or respective owner

Related posts about c#

Related posts about regex