C#

.Net Tips – use [field:NonSerialized] to stop serializing your event handlers

In C#, when you define an event in your class, e.g.: the event handlers will be serialized along with other properties, etc. This is because under the hood, the compiler translates your event into the following, as can be seen through JetBrain’s dotPeek decompiler: Since the generated EventHandler is not marked with the [NonSerialized] attribute …

.Net Tips – use [field:NonSerialized] to stop serializing your event handlers Read More »

Performance Test – Binary serializers Part II

Note: don’t forget to check out the Benchmarks page to see the latest round up of binary and JSON serializers. A little while ago I put together a quick performance test comparing the BCL’s BinaryFormatter with that of Marc Gravell‘s protobuf-net library (.Net implementation of Google’s protocol buffer format). You can read more about my …

Performance Test – Binary serializers Part II Read More »

Performance Test – SortedDictionary vs Dictionary vs Map vs Array

I stumbled upon this interesting question on StackOverflow today, Jon Harrop’s answer mentions a significant overhead in adding and iterating over a SortedDictionary and Map compared to using simple arrays. Thinking about it, this makes sense, the SortedDictionary class sorts its constituent key-value pairs by key, which will naturally incur some performance overhead. F#’s Map …

Performance Test – SortedDictionary vs Dictionary vs Map vs Array Read More »

Nancy self hosting

One of the great thing about Nancy is that you can host it in pretty much everywhere, and that includes inside a console app! The documentations seems to be missing the self-hosting option however, but it’s easy and only takes a minute. First, create a console app and get the Nancy.Hosting.Self package from NuGet: Then …

Nancy self hosting Read More »

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close