Category: C#

How to Format a Type with ToString () in C#?

The ToString method of a type will show the type’s name. For example , If the Object is the Employee type , then calling the ToString will display the Type Name along with the name space as shown in the below screenshot. You can override the ToString method to provide you own way to display the data when ToString is called. How to Format a…

C# Compiler Warning – CS0282 there is no defined ordering between fie

In this blog post, you’ll learn more about the C# Compiler Warning – CS0282 and the related message description C# Compiler Warning Code CS0282 C# Compiler Description for the Code :CS0282 There is no defined ordering between fields in multiple declarations of partial struct ‘{0}’. To specify an ordering, all instance fields must be in the same declaration.

Main function in c# and return type

Below is a sample source code demonstrating the Main function with no return type and return type. Example for return type of void class Program     {         static void Main(string[] args)         {             Console.WriteLine(“Return type is void”);         }     } Example for return type of int static int Main(string[] args)         {             Console.WriteLine(“Return type is int”);             return 0;                    …