Tag: C#

  • How to read optional attributes in XML with default values

    How to read optional attributes in XML with default values

    When we are reading data from XML data sources, it is very common that when a value is not given for an attribute or an element, we have to use a default value instead. Having to check for the existence of the node each and every time we are reading a value can be annoying…

  • A simple trick to gain some optimization in your code

    I see some times developers do not optimize recursive functions┬áto put less load on stack although many times it can be done with some simple changes in the code without even affecting usability. Lets assume we have a recursive function like the following (which is a C# implementation of the Wikipedia version mentioned here): To…