Category: C#

How to make a Type Sortable on Different Criteria in C# ?

IComparable interface is a great way to sort your objects by using the sorting routines of the List. There is a another interface called IComparer<T> which allows the objects to be sorted based on different criteria. How to make a Type Sortable on Different Criteria in C# ? For example , if you wanted to sort the Employee objects by Id , you can create…

C# Compiler Error – CS8904 invalid variance: the type parameter ‘{1

In this blog post, you’ll learn more about the C# Compiler Error – CS8904 and the related message description C# Compiler Error Code CS8904 C# Compiler Description for the Code :CS8904 Invalid variance: The type parameter ‘{1}’ must be {3} valid on ‘{0}’ unless language version ‘{4}’ or greater is used. ‘{1}’ is {2}.

C# Compiler Error – CS7070 security attribute ‘{0}’ is not valid on

In this blog post, you’ll learn more about the C# Compiler Error – CS7070 and the related message description C# Compiler Error Code CS7070 C# Compiler Description for the Code :CS7070 Security attribute ‘{0}’ is not valid on this declaration type. Security attributes are only valid on assembly, type and method declarations.