Span<T> is yet another addition to C# 7.x and is particularly useful in developing memory intensive applications. So what is Span all about ? As Microsoft describes it, Span<T> is a new value Type which enables the representation of contiguous regions of arbitrary memory, regardless of whether the memory is associated with a managed … Continue reading Benchmarking Span<T> Performance
Tag: C#
Reference Semantics and Code Readability
One of the features Microsoft packed with C# 7.2 is Reference Semantics with Value Types. Though designed with the intention to improve performance by eliminating the need for copying (and thereby allocating memory) value types , I do have my reservations on the complexity it adds to readability of code for a programmer. Let's consider … Continue reading Reference Semantics and Code Readability
Regular Expression – Compiled vs Interpreted
Regular Expression gives the developer a clean and efficient method to parse strings. However, it comes at a cost - there is a inherent performance hit associated with regular expressions, especially if you are running some kind of long loops and parsing the string inside it. One way to tackle it is using compiled regular … Continue reading Regular Expression – Compiled vs Interpreted
Design Patterns : Strategy Pattern
If there is one thing that is constant in every software development projects, then it has to be CHANGE. Requirements evolve overtime and you might end up with fairly different set of requirements that you initially started of. As developers one has to be aware of the possibility of change and design applications that are flexible … Continue reading Design Patterns : Strategy Pattern
Caliburn Micro #02 : BindableCollection & Events
In the previous part of this series, we looked into some of the basics of using Caliburn Micro. In this part, we will continue with few more examples, how to invoke a method on an event. But before we do that, let's expand our application a bit. Currently the application has two Text controls , … Continue reading Caliburn Micro #02 : BindableCollection & Events
Caliburn Micro #01 : Introduction
It has been long since i blogged, having caught up with the Product Release and Year End Vaccations. As the calender turns, it would be a good time to learn something new. If you are building an WPF application and is looking out for MVVM Frameworks, you would be surprised with the amount of choices … Continue reading Caliburn Micro #01 : Introduction
Evil Code #004 : Conditional Attribute
Continuing with our series of subtle changes that make differences, let's look into Conditional Attributes over Directives. What would be the output of above code under a) Debug Mode b) Release Mode The Debug Mode should be easy and as expected Hello Method01 Hello Method02 One 2 All Done What about release mode ? 3 … Continue reading Evil Code #004 : Conditional Attribute
Evil Code #003 : Casting
Welcome to first post on 'Back to basics'. Yeah, as you guessed right, this series attempt to check minor differences in our understanding of basic concepts. Predict the output of following. Ideally, One would expect the first attempt to fail, but would feel the second would succeed considering we have implemented implicit conversion. But unfortunately, … Continue reading Evil Code #003 : Casting
Design Patterns : Adapter Pattern
There is already a large amount of literature on the Internet which discusses Adapter Pattern. However, the purpose of article is to showcase the implementations of the Adapter Pattern, rather than discussing the application of the pattern. In this post, adapter class is implemented using 1. Inheritance 2. Dependency Injection 3. Generics Consider your old … Continue reading Design Patterns : Adapter Pattern
Serialize Deserialize NameValueCollection
Don't ask me why one cannot Serialize/Deserialize a NameValueCollection, but the workaround for the same is based on conversion to dictionary. I ended up writing extension methods to NameValueCollection for serializing and deserializing the collection.