Category: C#

How to get the CommandLine of the Current Application in C# ?

You might need to get the information that contains the commandline which is used to execute the current application in C#. How to get the CommandLine of the Current Application in C# ? You can use the CommandLine property of the System.Environment class that provides the necessary information including the application name. The output of the program would be Command line of the Abundantcode app…

Cast Operator with Anonymous Types

Below is a sample sourecode that demonstrates the usage of the Cast Operator when using the anonymous type Cast Operator with Anonymous Types When the element within the List cannot be converted to the target type, you will receive an exception “InvalidCastException”.

The ? (ternary) Operator in C#

The ? Operator is the ternary operator and takes the following form Expression1? Expression2: Expression3; The Expression1 is an expression which returns Boolean result. Expression2 is considered if the Expression1 is true else Expression2 is taken.

C# Compiler Error – CS1973 ‘{0}’ has no applicable method named ‘{1

In this blog post, you’ll learn more about the C# Compiler Error – CS1973 and the related message description C# Compiler Error Code CS1973 C# Compiler Description for the Code :CS1973 ‘{0}’ has no applicable method named ‘{1}’ but appears to have an extension method by that name. Extension methods cannot be dynamically dispatched. Consider casting the dynamic arguments or calling the extension method without…

What are the different types of comments in C#?

There are 3 different types of comments in C#. These include 1. Single Line CommentThe single line comment is specified using the symbol // Eg: // this is a AbundantCode comment 2. Multi Line CommentThe Multiline comment can be specified using the symbol /* */ Eg: /* This is a test comment */ 3. XML CommentThis is a special kind of comment which is generally…