C#

Why and Where to use Delegate in C#

I am going to explain why and where we need to use delegates in C#. Let’s suppose we have an investment application, which takes investment from customers and then calculates profit on the basis of investment. We have some rules … Read More

Difference between Action and Func in C#

Difference between Func<T> and Action<T> in C# and where to use them. Let’s suppose we have small program which returns a number using a delegate  static void Main(string[] args){MyCalculations del = MyCalculationsMethod;int value = del.Invoke(5); Console.WriteLine(“Result is: ” +value);}public static … Read More

How to run Asynchronous task and override it

We need to run Asynchronous task due to some requirements but we want that to be override able, unfortunately that is not possible however we can create Asynchronous method but then call that method inside of Synchronous method and make … Read More

How to install and uninstall a window service created in C#

First make sure you have all files you need to install a Windows Service (dll, sql, anything else needed) To install a Windows service use the command below installutil MyWindowService.exe First open Developer Command Prompt for Visual Studio andthen navigate … Read More

How to debug a Windows Service in Visual Stdio once it is installed

To debug a Windows Service once it has been installed followthe steps below 1)Copy the pdb files in the same folder where restof the dlls are for Windows Service 2)Go to visual studio and Tools>Attach toProcess 3)Look for something with … Read More

WPF: How to get a selected row value from Datagrid on double click

A very simple of  getting a selected row value from Datagrid on double click… 1) Create a double click event on WPF form/window private void uxABC_MouseDoubleClick(object sender, MouseButtonEventArgs e){ myData decData = uxABC.SelectedItem as MyData; Guid myId = decData.MyId; } … Read More

WPF call main parent control in child control with event handler

Below is a simple example of a WPF solutio and explains how to call a parent control’s method in child control click event. In this case we will be using 1) Main window 2) Parent user control 3) Child user … Read More

wcf service wsdl domain name

When creating a new WCF and hosting locally or dev/prod server you might come across an issue where WSDL will display a URL with computer/local name which is different to URL of service Fro example actual URL might be And … Read More