.Net

F# equivalent of C#’s Object Initialization syntax

In C#, you can use the object/collection initialization syntax like this: The F# equivalent of object initialization is done like this: As for collection initialization, you have a far more diverse range of tools available to you, for example: You can also create slices of an existing array: You can even add your own multi-dimensional …

F# equivalent of C#’s Object Initialization syntax Read More »

.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 »

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