|
Programmatically Retrieve Information About Windows Services Using ServiceController
ServiceControl can be used to get information about a Windows Service on a machine. In this post I will show you how to retrieve information about a service using ServiceControl.
To begin with lets examine the properties for ServiceControl. Through the designer we can set the ServiceName property. This can be set to the name of [...]
LINQ Equivalent Of Where IN
Working with LINQ to SQL I came across a need of writing a LINQ query equivalent of T-SQL “Where IN” clause. This is what T-SQL query looks like.
SELECT CustomerID, CompanyName, ContactName, ContactTitle, Address,
City, Region, PostalCode, Country, Phone, Fax
FROM [...]
Bulk Copy Data Using SQLBulkCopy Class
SQLBulkCopy class in ADO.NET can be used to do bulk copy operations from a .Net application. There are two ways data can be bulk copied using this class. You can either do a single bulk copy or a multiple bulk copy operation. In this post I will show you how to perform a single bulk [...]
Find Duplicates Using LINQ
How can we find duplicate occurrences of values in a collection? I will demonstrate this here using a collection of cities. City class looks like this:
public class City
{
public string Name { get; set; }
public string Country { get; set; }
}
Cities collection is initialised with this code:
List<City> cities [...]
Different Flavors Of LINQ
You may have noticed from my blog posts lately that these days I am spending considerable time working with LINQ. Although I mainly concentrate on LINQ To Objects and LINQ To XML, I often wander around and play with other flavors of LINQ as well. Today, just out of curiosity I wanted to see how [...]
MSDN Library For Visual Studio And .NET 3.5 SP1
While working, you will always find two things running on my machine. One is without any doubt Visual Studio and second is MSDN Library. Since this morning after installing Visual Studio 2008 SP1 I’ve been trying to get my hands on the latest MSDN Library. Thanks to Iftekhar who pointed me to the latest [...]
Tutorial Reading A Text File Using LINQ
Introduction
At times us developers have to deal with delimited text files in our applications. Such files have been around since yonks and I often come across data import/export tasks where delimited files are used. Till now the common way in .NET has been to read each line and then extract data using some sort of [...]
Exam 70-502 Microsoft .NET Framework 3.5 Windows Presentation Foundation Study Links – Part 2
Back in may I posted Part 1 of this series on my old blog. Looking at the statistics it turned out to be one of the highly visited post. Recently I also had a comment asking me when I was publishing other parts of study links. Continuing the same trend here is the second part [...]
Refactoring In Visual Studio 2008
While there is a lot of talk about refactoring tools such as Resharper and Refactor Pro, not much is said about refactoring features available in Visual Studio 2008 straight out of the box. I think Resharper and Refactor Pro are fantastic tools but they cost money and most of the time our refactoring needs are [...]
Write To Vista Event Log Using C#
Event Log is a central place to log application events. These events can be errors, warnings or just information. Each event log entry in Windows Vista has a level of event, date and time the event occurred, source of event, an event Id and a task category. While event logs such as Application, System, Security [...]
StyleCop Tutorial
StyleCop is a source analysis tool for C#. It can be used for analysing source code as opposed to compiled assemblies which is the area for FxCop. StyleCop is currently in version 4.2 and can be downloaded here. In this tutorial I will show you how to use StyleCop.
I will create a simple console application [...]
Dynamic Sort With LINQ
In this post I will show you how to perform dynamic sorting with LINQ. I will work with a simple collection of City class. City class is defined below.
public class City
{
public string Name { get; set; }
public string Country { get; set; }
}
The collection is initialised using [...]
Get Updates By Email
Popular Post
Tag Cloud
Code Snippets
- Get Current Windows User In C#
- Get Width And Height Of Image In C#
- Get Windows Registry Size With WMI And C#
- Reverse Array Elements Using C#
- Convert Hexadecimal To Number In C#
- Get Free Disk Space Using T-SQL
- SQL Server 2008 – Get All Indexes In A Database
- Get Name Of Current Executing Assembly In C#
- Get CD Or DVD Drive Information Using WMI And C#
- Get Last Row From Table Using LINQ To SQL

