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

Switching Context With Async

Whenever an await is encountered in the code, a context is captured, which is later used when the promise is completed and ready to continue. If the method is called by the UI thread, usually, the context could be UI context, unless the awaited method itself creates a new thread. This can be demonstrated in … Continue reading Switching Context With Async

Multicasting with Action

Func and Action are inherited from System.MulticastDelegate, which means that you could actually do multicasting with them and add multiple methods to the InvocationList. Let's check how we do it. Output of above code would be The same can be done with Func as well. How do we remove one Action , same syntax as … Continue reading Multicasting with Action

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

Collection of Custom Configuration

Adding application configuration in app.config, especially under the appSetting key is something which every developer is used to. What if we need to add our own customer collection. For example, That's when we need to write up code to define these customized segments. We will begin with the basic element first, which in this case … Continue reading Collection of Custom Configuration

Customized Debugger Tooltip

Code-Execute-Debug-Code-Execute-Debug.. This seems to be never ending cycle for any developer. Considerable amount of time of this cycle is spend in Debug phase, wherein user steps through breakpoints and traverse the objects and their properties. Thankfully, Microsoft has ensured that primitive types always shows the value, instead of any less-meaningful information. But what happens when … Continue reading Customized Debugger Tooltip