Contents tagged with C#

  • Working with MongoDB Using C#

    In this blog post I am going to show you how you can access and perform CRUD operation from C# based application against MongoDb. In our application, we are going to persist & read feed data from underlying mongodb database. Feeds are used by websites to publish the frequently updated information. Many websites publish their feed url. We can subscribe to those feeds via online feed readers and keep our self up to date with latest changes. In our application we are going to do the following :

  • Check If the Screen Saver Is Running Or Not?

    Although its rare but at times while building desktop based applications, we might come across situation wherein we are asked to handle “Screen Saver” operation i.e. perform some logic based on whether the “Screen Saver” is on of off. I found the following code snippet on internet almost two years back. I would like to thank the original author of the code. It’s been long time and its not possible for me to search for the original author of the code.

  • Asynchronous Web Api Action Methods

    In one of my recent WPF project, we made extensive use of async-await pattern. Async-await pattern greatly simplified the call-back and continuation based code required for keeping the UI responsive. In WPF, the pattern for implementing async-await is to invoke the IO/CPU intensive code in a background thread and attach the continuation logic on the main UI thread. In WPF, since we have a dedicated UI thread that controls all of the UI elements, using async-await is really helpful in keeping the UI responsive without having to write complicated call-back based code.

  • WPF MVVMLight Toolkit & Capturing Control Events

    If you have worked with MVVMLight toolkit framework, then you must be familiar with the RelayCommand pattern for processing control commands. For example, if you have to handle the button click event using MVVMLight framework i.e. to not have the code-behind button click event handler but instead call some method in your ModelView class, then you can do it easily using the RelayCommand pattern. Below is a sample example :

  • Inauguration Of My Laptop

    Today I received my new laptop which is an Intel Core i5-2450M @ 2.50GHz 4 GB RAM machine . The other laptop(office provided) which I have used for past two years for programming is an Intel Core2 Duo T6570 @ 2.10GHz machine. Reason why I am talking about the laptops that I own is because of my interest in writing multi-threaded/parallel code using the new TPL API provided in the .Net 4.0 framework.

  • Generic Delegate Types : Func,Action and Predicate

    C# language has observed dramatic transformation from 2.0 to 3.0 and finally with 4.0. C# 2.0 added generics , simplified delegate syntax, nullable types etc. C# 3.0 takes it a level next by adding LINQ , anonymous methods , anonymous types etc and finally C# 4.0 add dynamism, enhances parallel programming by introducing Task Parallel Library. Of all these changes , some are altogether new functionalities in language , some enhance previous features by adding additional capabilities or by just simplifying the syntactical structure. Now we have multiple ways of doing a particular task. Consider iterating through a list of objects. As a developer you can use basic foreach loop, write a LINQ query(either extension method syntax or query based format) or Parallel.ForEach(conditions applied :)) construct.

Contact Me

rk.pawan@gmail.com | +1-737-202-7676 | LinkedIn | Facebook | Github |