Tag: C#
How to Remove Duplicates and Get Distinct records from List using LINQ?
Below is a sample source code demonstrating on how to remove duplicates and get distinct records in List using LINQ and C#?
Example of Function Delegates in C#
Below is a sample code snippet that demonstrates the function delegates or lambda expression in C# . Example of Function Delegates in C#
How to Detect Windows Phone OS version using C#?
The Windows Phone SDK provides the Environment.OSVersion property which can be used to detect the version of the Operating System uses in Windows Phone (Windows Phone 8 / Windows Phone 7). Below is a code snippet that demonstrates how to detect the Windows Phone OS Version using C#. How to Detect Windows Phone OS version using C#?
How to select unique names from a List using LINQ in C#?
Below is a sample code snippet demonstrating on how to get unique or distinct names from a list in C# using LINQ query. How to select unique names from a List using LINQ in C#?
DateTime and Null value in C#
Assume that you want a variable of type DateTime and you would like to have the uninitialized value or null value , you can use the nullable DateTime type. DateTime and Null value in C# When you define a DateTime variable and dont initialize it , the default value is the DateTime.MinValue. You can simply define the type as Nullable DateTime as shown in the…
How to Get the File Version of the Assembly in .NET (C#)?
The developers can use the methods and properties available in the FileVersionInfo class to retrieve the File Version of the Assembly in .NET (C#). How to Get the File Version of the Assembly in .NET (C#)? Below is a sample code snippet demonstrating how to retrieve it.
SelectMany Example in LINQ and C#
Below is a sample source code demonstrating the usage of the SelectMany method in LINQ and C#. One of the usage of the SelectMany is to return the flat list an avoid returning the lists of lists. SelectMany Example in LINQ and C#
How to Round the Decimal Value to 2 Decimal Places in C# ?
If you want to round the decimal value to 2 decimal places , one can simply use the .ToString method by providing the format specifiers as shown below. How to Round the Decimal Value to 2 Decimal Places in C# ?
How to Convert a Number to Bytes Array in C# ?
To Convert a number to a byte array , the developers can use the BitConverter.GetBytes method which returns array of bytes. How to Convert a Number to Bytes Array in C# ? Below is a sample code snippet demonstrating how to convert a Number to Byte Array in C# .
How to Copy a Song to Windows Phone Music Hub/Library using C#?
Below is a sample code snippet that demonstrates how to copy a song (audio) to the Windows Phone hub/library Programatically using C#. How to Copy a Song to Windows Phone Music Hub/Library using C#? The SaveFileToIsolatedStorage is explained in the How to Save File to Isolated Storage in Windows Phone 8? Article
Using or Operator in the Where Clause of LINQ in C#
Below is a sample code snippet demonstrating on how to use “Or” Operator in the Where Clause of Linq in C#? Using or Operator in the Where Clause of LINQ in C#
How to use Named Parameters in C# ?
Named Parameters is one of the cool features in C# 4.0 that lets you to call the methods with the parameters with their names . How to use Named Parameters in C# ? Below is a sample code snippet demonstrating the usage of the Named Parameters in C#.