Category: C#
C# Compiler Error – CS0723 cannot declare a variable of static type
In this blog post, you’ll learn more about the C# Compiler Error – CS0723 and the related message description C# Compiler Error Code CS0723 C# Compiler Description for the Code :CS0723 Cannot declare a variable of static type ‘{0}’
C# Compiler Warning – CS1591 missing xml comment for publicly visible
In this blog post, you’ll learn more about the C# Compiler Warning – CS1591 and the related message description C# Compiler Warning Code CS1591 C# Compiler Description for the Code :CS1591 Missing XML comment for publicly visible type or member ‘{0}’
C# Compiler Error – CS7086 module name ‘{0}’ stored in ‘{1}’ must m
In this blog post, you’ll learn more about the C# Compiler Error – CS7086 and the related message description C# Compiler Error Code CS7086 C# Compiler Description for the Code :CS7086 Module name ‘{0}’ stored in ‘{1}’ must match its filename.
C# Compiler Warning – CS4026 the callermembernameattribute applied to
In this blog post, you’ll learn more about the C# Compiler Warning – CS4026 and the related message description C# Compiler Warning Code CS4026 C# Compiler Description for the Code :CS4026 The CallerMemberNameAttribute applied to parameter ‘{0}’ will have no effect because it applies to a member that is used in contexts that do not allow optional arguments
C# Compiler Error – CS1073 unexpected token ‘{0}’
In this blog post, you’ll learn more about the C# Compiler Error – CS1073 and the related message description C# Compiler Error Code CS1073 C# Compiler Description for the Code :CS1073 Unexpected token ‘{0}’
How to Create an Empty array without defining the size in C# ?
When we create an array in C# , we tend to define the size of the array as shown below. Can we create an array without defining the size ? The best option in this scenario is to use the collection. You can use the Generic List which allows you to add as many items as possible and then you can use the ToArray method…
C# Compiler Error – CS0743 expected contextual keyword ‘on’
In this blog post, you’ll learn more about the C# Compiler Error – CS0743 and the related message description C# Compiler Error Code CS0743 C# Compiler Description for the Code :CS0743 Expected contextual keyword ‘on’
How to set a property value by reflection in C# ?
There are times when you want to set the property of an object using reflection in C#. Below is a sample code snippet demonstrating how to do it taking the Employee class as an example and Name as the property. How to set a property value by reflection in C# ?
C# Compiler Error – CS0210 you must provide an initializer in a fix
In this blog post, you’ll learn more about the C# Compiler Error – CS0210 and the related message description C# Compiler Error Code CS0210 C# Compiler Description for the Code :CS0210 You must provide an initializer in a fixed or using statement declaration
C# Compiler Error – CS8344 foreach statement cannot operate on enum
In this blog post, you’ll learn more about the C# Compiler Error – CS8344 and the related message description C# Compiler Error Code CS8344 C# Compiler Description for the Code :CS8344 foreach statement cannot operate on enumerators of type ‘{0}’ in async or iterator methods because ‘{0}’ is a ref struct.
C# Compiler Error – CS0153 a goto case is only valid inside a switc
In this blog post, you’ll learn more about the C# Compiler Error – CS0153 and the related message description C# Compiler Error Code CS0153 C# Compiler Description for the Code :CS0153 A goto case is only valid inside a switch statement
Null Coalescing Operator (??) in C#
The .NET Framework provides the Null Coalescing Operator (??) which is a kind of binary operator and enables the developers to quickly check for the null values . The Null Coalescing Operator (??) in C# can be used with Nullable types as well as reference types . For example , a??b .If a is not null then assign the value a else take the value…
C# Compiler Warning – CS0105 the using directive for ‘{0}’ appeared p
In this blog post, you’ll learn more about the C# Compiler Warning – CS0105 and the related message description C# Compiler Warning Code CS0105 C# Compiler Description for the Code :CS0105 The using directive for ‘{0}’ appeared previously in this namespace
C# Compiler Warning – CS3027 ‘{0}’ is not cls-compliant because base
In this blog post, you’ll learn more about the C# Compiler Warning – CS3027 and the related message description C# Compiler Warning Code CS3027 C# Compiler Description for the Code :CS3027 ‘{0}’ is not CLS-compliant because base interface ‘{1}’ is not CLS-compliant
C# Compiler Error – CS1113 extension method ‘{0}’ defined on value
In this blog post, you’ll learn more about the C# Compiler Error – CS1113 and the related message description C# Compiler Error Code CS1113 C# Compiler Description for the Code :CS1113 Extension method ‘{0}’ defined on value type ‘{1}’ cannot be used to create delegates
C# Compiler Warning – CS8764 nullability of return type doesn’t match
In this blog post, you’ll learn more about the C# Compiler Warning – CS8764 and the related message description C# Compiler Warning Code CS8764 C# Compiler Description for the Code :CS8764 Nullability of return type doesn’t match overridden member (possibly because of nullability attributes).
How to Get Connection String from App.config file in C# ?
If you want to get the connection string from the App.config file in C# , you can use the ConfigurationManager class to achieve the same. How to Get Connection String from App.config file in C# ? Assume that the configuration file contains the following Below is the code snippet to get the connection string.
How to Parse a string to Nullable Int in C# ?
Below is a sample code snippet demonstrating how you can convert a string to Nnullable Int in C#. How to Parse a string to Nullable Int in C# ? We use the int.Parse and based on its return value , assign the null or integer value to the Nullable Int.
How to Get the Name of the Anonymous class(type) in C# ?
Below is a sample code snippet which gets the name of the anonymous class . In the below example , the Name and the ID property is set which is anonymous where the type is not specified. When trying to find out the type of the anonymous type , you will get the type as shown in the screenshot below. How to Get the Name…
C# Compiler Error – CS0051 inconsistent accessibility: parameter ty
In this blog post, you’ll learn more about the C# Compiler Error – CS0051 and the related message description C# Compiler Error Code CS0051 C# Compiler Description for the Code :CS0051 Inconsistent accessibility: parameter type ‘{1}’ is less accessible than method ‘{0}’