Archives for C# – the language
Task Async Await
Long Running Task that returns an int call result = await The method containing the Task has to be marked async The method running the long running task also needs…
Books on Algorithms
Also see my – Problem Books for Pure Math, Physics and Mathematical Physics If you are looking for a recap of computer science algorithmic concepts either for fun or for…
Recursion versus Iteration ( Looping )
Overview In general, whatever problem you can solve with Recursion can also be solved with Looping (iteration). It turns out, that for most use cases, Iteration (looping) performs better than…
Binary tree (count nodes) interview question
Given a LEFT and a RIGHT property that returns the underlying LEFT tree and the underlying RIGHT tree respectively, find the total count of the nodes in the BinaryTree<T>{ private…
LINQ–search for items in a list that are present in another list
Suppose you have a list of strings – a nursery rhyme may be a good ; And you need to find ALL the words that match from another list of…
Filesystem notes from the real world–C#
These are just some quick tidbits about file processing in C#. Reading in files, reading in LARGE files, Reading and Processing Large Files. Reading a file (use a StreamReader) if…
Using Delegates in C#
Introduction Delegates encapsulate a method. All they do is provide an alternate way to call (‘invoke’) a method. This concept has been around for a while (function pointers in C…
The ‘params’ keyword in c#
Introduction I was confused by the appearance of ‘params’ in the signature of a method (see example snippet below). It seemed redundant – even if I removed it, the method…
Async and Await, an easy way to keep your user interface responsive
Introduction Normally, when you invoke a method, it is invoked synchronously on your calling thread. Since you made no provision to ‘unblock’ the main thread, the method essentially ‘blocks’ the…
The Publish Subscribe Pattern in C# and some gotchas
This post does three things: Provides a complete implementation of the publish subscribe pattern in C#. Highlights 4 potential issues that are inherent to ANY publish subscribe implementation – including…