How to store data per request with WebAPI

This is going to be a short one. If you need to store some data and make it available to methods the most logical place to me is HttpContext. More precisely HttpContext.Current.Items collection which should always be available during a request processing. So basically, in order to add the item you’ll need later during the […]

Read More

Random DateTime in the range (C#)

So You need a random DateTime value in some range, and C# Random class does not provide Random.NextDateTime(from, to). Here’s a simple solution for this problem…

  As this method is written as an extension method to Random class, you’ll be able to use it just as a static Random class method (Random.NextDateTime(startDateTime, endDateTime). […]

Read More