tutorials

C# Program to input the Number and display the sum of the Digits

Introduction

This program in C# developed using .NET Framework 4.5 and Visual Studio 2013 will demonstrate how to get the input as number and find the sum of digits of the number and display it in the console window.

C# Program to input the Number and display the sum of the Digits

using System; using System.Collections.Generic; using System.Linq; using

read more

How to Get the List of All Drives installed in the System using C# ?

If you need to get the list of all drives installed on your system using C# , you can use the DriveInfo class which provides the static method GetDrives.

How to Get the List of All Drives installed in the System using C# ?

Below is a code snippet that iterates through all the drives and provides the necessary information about them.

using System; using System.Collections.Generic; using System.Globalization; using

read more

Using SQL “IN” Clause in LINQ Query

When using the SQL Query, we could use the IN keyword to find the item something like this

SELECT * FROM MOVIES WHERE Movie_Name IN ('Thalaivaa', 'Jilla', 'Arrambam')

How to use achieve the similar results when using LINQ?

Using SQL “IN” Clause in LINQ Query

You could use the contains extension method to achieve the similar result as shown in the below code snippet.

string[

read more

Anonymous Delegate and Anonymous Type in C#

Below is a simple example demonstrating the usage of the Anonymous Delegate which is assigned to the Fun class.

The example demonstrates the delegate which concatenates the FirstName and last name of anonymous type and displays it

Anonymous Delegate and Anonymous Type

Func<string, string, string> FullName =delegate(string FirstName

read more