Tag: C#
How to get the total number of items in a Enum in C# ?
If you want to get the total number of items that is defined in an enum using C# , you can use the Enum.GetNames static method combined with the Length property. How to get the total number of items in a Enum in C# ? Here’s a code sample demonstrating how to do it. This would display 3 in the console.
How to Group Digits of a Number for Formatting in C# ?
If you want to group the digits of a number for formatting to display in C# , one could use the “N” formatting option . Below is a code snippet demonstrating how to use it. How to Group Digits of a Number for Formatting in C# ?
Example of Chaining LINQ Query Operators in C#
Below is a sample source code snippet demonstrating the chaining of LINQ operators in C#. Example of Chaining LINQ Query Operators in C#
Case insensitive string comparison for Contains in C#
When using the string.contains method , the comparison is done based on the exact string that is passed as parameter. In this case , the comparison is case-sensitive. using System; namespace ACConsoleApp { class Program { static void Main(string[] args) { string input = “This is a WeLcome string”; var output = input.Contains(“Welcome”); Console.WriteLine(output); Console.ReadLine(); } } } In the above code snippet , the…
How to Get the List of Appointments from the Calendar App in Windows Phone using C# ?
If you want to programmatically get the list of appointments from the calendar application of your Windows Phone device programmatically , you can use the Microsoft.Phone.UserData.Appointments. How to Get the List of Appointments from the Calender App in Windows Phone using C# ? Enable the ID_CAP_APPOINTMENTS in the WMAppManifest file and then create an instance of the Appointments class and call the SearchAsync method with…
How to Concatenate Strings in C# using LINQ?
Assume that you have an array/List of string which needs to be concatenated. One can concatenate strings using + operator, StringBuilder etc. . . . How about concatenating strings using LINQ? Below is a sample source code that demonstrates how to concatenate strings in C# using LINQ? How to Concatenate Strings in C# using LINQ?
How to Download Web Content asynchronously in C# ?
In one of the previous article , we demonstrated on how to download Web Content asynchronously in C# . This article will demonstrate how to do it asynchronously. How to Download Web Content asynchronously in C# ? The output file is generally saved in the same folder where the exe exists.
C++ Program to display "Hello, World!"
Problem Write a program in C++ to display “Hello, World!” on the screen. C++ Program to display “Hello, World!” in Console Window. This is a simple C++ program that displays “Hello, World!” on the console window. This program provides a quick insight on to the syntax of the C++ language for the beginners. Output Hello, World! The C++ programs starts with the main() function. The…
How to read data from text file in C#?
Below is a sample code snippet demonstrating in simple steps on how to read data from text file in a console application in C# and display it? How to read data from text file in C#?
Convert All Strings in a List to Upper Case using LINQ in C#
Below is a sample code snippet which demonstrates on how to convert all strings in a list to upper case using LINQ in C#.
?
How to Catch the Unhandled Exceptions in C# ?
Are you looking for a way to catch the unhandled exception and perform the operation like logging etc. before the application terminates ?. Below is a sample code snippet that demonstrates how to do it in Console Application. How to Catch the Unhandled Exceptions in C# ?
How to Initialize the Static Variables via Static Constructors in C# ?
Do you want to initialize the static variables in static constructors in C# ? Below is a sample code snippet that demonstrates how to do it . How to Initialize the Static Variables via Static Constructors in C# ?