Category: C#

C# Compiler Error – CS7007 a ‘using static’ directive can only be a

In this blog post, you’ll learn more about the C# Compiler Error – CS7007 and the related message description C# Compiler Error Code CS7007 C# Compiler Description for the Code :CS7007 A ‘using static’ directive can only be applied to types; ‘{0}’ is a namespace not a type. Consider a ‘using namespace’ directive instead

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: In the above example, the initialization of the name was done using “string” and hence name will be implicitly treated as string. Note…

How to Create an Interface in C# ?

You might need to few functionalities without defining any implementation of the abstract methods. This should later be applied to various types within your project. In this case , one can create an interface which specifies some behavior rather than what the type or member is all about. How to Create an Interface in C# ? Below is a sample interface called IMusic The interface…

C# Compiler Error – CS8414 foreach statement cannot operate on vari

In this blog post, you’ll learn more about the C# Compiler Error – CS8414 and the related message description C# Compiler Error Code CS8414 C# Compiler Description for the Code :CS8414 foreach statement cannot operate on variables of type ‘{0}’ because ‘{0}’ does not contain a public instance or extension definition for ‘{1}’. Did you mean ‘await foreach’ rather than ‘foreach’?