Category: C#

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 {     class Program     {         static void Main(string[] args)         {             foreach (string…

Example of Object Initializer in C#

Object Initializer is one of the cool features in C# that lets the developers to initialize the objects as and when they are declared . Example of Object Initialize in C# Below is a sample code snippet that demonstrates how to use Object Initializers in C#.

C# Compiler Warning – CS0658 ‘{0}’ is not a recognized attribute loca

In this blog post, you’ll learn more about the C# Compiler Warning – CS0658 and the related message description C# Compiler Warning Code CS0658 C# Compiler Description for the Code :CS0658 ‘{0}’ is not a recognized attribute location. Valid attribute locations for this declaration are ‘{1}’. All attributes in this block will be ignored.