Category: C#

LINQ Aggregate Methods in C#

LINQ Aggregate methods help in various common calculations like getting average, count, sum etc of values in a collection.  In C#, we have 6 LINQ Aggregate methods. Min():  LINQ Aggregate Min method will give us lowest value in a collection. Max():  LINQ Aggregate Max method will give us highest value in a collection. Average():  LINQ

What is LINQ in C#

LINQ stands for Language Integrated Query.  LINQ enables us to query various type of data sources such as SQL server, XML documents,  in memory objects like arrays and generics.  In general, if you want to fetch a data from a data source, then you must need to have some technical info about the underlying technology

Extension Methods in C#

Extension methods were introduced in dotnet framework 3.5.  Extension methods are basically an instance methods which are added to an existing type without creating a new derived type, recompiling, or originally modifying the code.  C# dotnet framework has provided us a lot of extension methods like where, aggregate, average etc. Behind the scenes, all extension

Creating Custom Attribute in C# with Example

This time, we are going to create a custom attribute class.  We have seen in previous tutorial how Obsolete attribute works.  We are going to replicate a bit of similar functionality in our custom attribute class. First of all, we will create a class called MyName which will inherit from System.Attribute class.  This custom attribute

Attribute in C# with Example

Attributes in DotNet are basically used to add declarative information to classes, properties, methods etc.  This declarative information can be retrieved using reflection at runtime.  An attribute is nothing more than a class which directly or indirectly inherits from Attribute class.  There are a lot of predefined attributes in DotNet framework.  However, you can also