Last Updated:
June 16, 2013

Foundation
Per Page :

Display the Command line parameters of the Main Method in C#

The Main Method in C# accepts the parameters of string Array. You could easily display the list of parameters of the Main Method in C# by using a for/foreach loop and display the parameters like the example show below using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication4 { Read more...
0 Views : 613

Example for Documentation Tags

using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Diagnostics; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace WindowsFormsApplication1 { #region testregion /// <summary> /// This is a test Class Form1 /// </summary> public partial class Form1 : Form { /// <summary> /// Constructor for the Form1 Read more...
1 Views : 471

C# Main() Method

Every C# Program should contain a Main method . This is generally the entry point for the Program When the C# Program starts , the Main method provides an entry point for the Program . The C# Compiler searched for the method Main method and executes the statements in the Read more...
0 Views : 486

How to Combine URL in C#?

The .NET Framework includes the Path.Combine feature which can be used to combine the strings into a path. How about having the same functionality to combine URL? How to Combine URL in C#? This is where the Uri class comes handy. The Uri class includes the constructor which can be Read more...
0 Views : 39

What is the default modifier for the class member in C#?

What is the default modifier for the class member in C#? In C#, the default modifier for the class member is private. The member in this case will be visible only within the current class. Read more...
0 Views : 37

What is the default modifier for the class in C#?

What is the default modifier for the class in C#? In C#, the default modifier for the class is internal. This is applicable of there is no modifier defined for the class. When the class is internal, then it is visible only within the current assembly.     Read more...
0 Views : 43

How to Convert Byte Array to String in C#?

Below is a sample code snippet demonstrating the conversion of  Byte Array to string in C#. How to Convert Byte Array to String in C#? using System; using System.Collections.Generic; using System.Data; using System.Linq; namespace AbundantCode { internal class Program { //How to Convert Byte Array to String in C# ? Read more...
0 Views : 65

How to Convert a String to Byte Array in C#?

Below is a sample code snippet demonstrating the conversion of string to Byte Array in C#. How to Convert a String to Byte Array in C#? namespace AbundantCode { internal class Program { //How to Implement Multiple order by in LINQ using C# ? private static void Main(string[] args) { Read more...
0 Views : 63

How to provide a default value for Auto Implemented Property in C#?

Sometimes, one might want to provide a default value for the auto implemented properties. For example, you might want to provide a default text for a string value instead of null. This can be achieved by providing the default value in the constructor for the properties. Below is a sample Read more...
0 Views : 106

Use of var keyword in C#

The var keyword in C# was introduced from C# 3.0 and it beings in the feature of local type inference or implicit type variable in C#. LINQ is one of the case where var keyword can be widely used in C#. Eg: var name = "Abundant Code"; In the above Read more...
0 Views : 93

How to read the complete content of the Text File in C#?

Here’s an easy way to read the complete content of the text file in c# with just one line of code. This is achieved using the System.IO.File.ReadAllText function. Below is a sample code snippet demonstrating how to read the complete content of the Text File in C#? The test1.txt contains Read more...
0 Views : 121

What are the difference between class and structure in C#?

What are the difference between class and structure in C#? Structure Struct are value types. They can be empty but a null cannot be assigned to Struct Structs cannot contain explicit parameterless constructors. Doesn’t support Inheritance and cannot use the protected or protected internal modifier. A Struct always has a Read more...
0 Views : 114

What is the Difference between String and String Builder in C#?

What is the Difference between String and String Builder in C#? The string instance is immutable i.e. each time when you change the string m a new instance is returned. This can be inefficient sometimes The StringBuilder allows the developers to have a mutable string. This is a good option Read more...
0 Views : 73

How to prevent the class from being inherited in C#?

How can one prevent the class from being inherited by another class using c#? It’s simple, mark the class as “sealed”. How to prevent the class from being inherited in C#? sealed public class BaseClass { public string MovieName { get; set; } } Read more...
0 Views : 113

How to Sort Array Elements in Descending Order in C#?

The Array class includes static method called Sort which can be used to sort the array in ascending order. After using the Sort method, one can use the Reverse method to sort the array back to descending order. How to Sort Array Elements in Descending Order in C#? Below is Read more...
0 Views : 141

How to Sort Array Elements in Ascending Order in C#?

The Array class includes static method called Sort which can be used to sort the array in ascending order in C#. Array.Sort(<arry>); How to Sort Array Elements in Ascending Order in C#? Below is a sample code snippet demonstrating sorting of array elements in ascending order in C#. using System; Read more...
0 Views : 144

How to enumerate an enum in C#?

Below is a sample code snippet that demonstrates how to enumerate an enum in C# using Foreach statement? How to enumerate an enum in C#? using System; using System.Collections.Generic; using System.Data; namespace AbundantCode { internal class Program { public enum CodingLanguages { CSharp, Java, Cplusplus, HTML } // How to Read more...
0 Views : 132

Lock keyword in C#

Want to get the mutual exclusion lock for a given object or a block of statement? If yes, you can use the lock keyword in C# which marks the start of the critical section. The lock keyword may be useful especially when you are using threading in your application. It Read more...
0 Views : 99

What are the different types of comments in C#?

There are 3 different types of comments in C#. These include 1. Single Line Comment The single line comment is specified using the symbol // Eg: // this is a AbundantCode comment 2. Multi Line Comment The Multiline comment can be specified using the symbol /* */ Eg: /* This Read more...
0 Views : 107

Ternary Operator Code Snippet in C#

Below is a sample source code demonstrating the ternary operator in c# using System; namespace AbundantCode { internal class Program { // Ternary Operator Code Snippet in C# private static void Main(string[] args) { int Input1 = 18, Input2 = 15; bool Output; Output = (Input1 > Input2 ? true Read more...
0 Views : 94