Browse by Tags

Tagged Content List
  • Blog Post: Initialization in static constructor

      I am implementing initialization of some static data properties of a class. The static data properties should be initialized only once. It can be used in multi threaded read scenarios. So the initialization should be thread safe. It looks like the static constructor is the right choice for this...
  • Blog Post: Adding time to DateTime instance

      Recently, I wrote code for adding seconds to a DateTime instance something like this: DateTime time = DateTime.Now; time.AddSeconds(100); In the first round of unit test, I realize that it is not working correctly. A quick reference to MSDN revealed the fact: “This method...
  • Blog Post: Null parameter validation

    Most of the functions take some input parameters and it is mostly wise not to trust the caller and do verification of input parameters. Input parameter validation involves checking some constraint for the parameter (like parameter is null or not, parameter value falls in some range or not, etc). If the...
  • Blog Post: Correlating ETW events using Activity Id in .Net

    In my previous post , I described using PowerShell script to correlate ETW events. For large event logs, the overall performance of the script is not very fast. Here is a .Net version of doing ETW event correlation: class ActivityData { public ActivityData() { this.Events...
  • Blog Post: Unit testing of scenarios throwing exception

    While writing unit tests, we frequently come across the cases where the scenario generates some exception. And we need to test them. Suppose have one SourceClass. It has a method ThrowExceptionIf () which throws ArgumentException exception when the input parameter throwException passed is true. ...
Page 1 of 1 (5 items)