
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Use LINQ in C#
Language Integrated Query (LINQ) is a Microsoft .NET Framework component and the uniform query syntax in C#. It has a set of method names and extends the language with query expressions.
For LINQ in C#, use −
using System.Linq;
Let us see an example. Here we have used the LINQ computational methods Count and Average to find the count of elements and average of those elements in C# −
Example
using System; using System.Linq; class Demo { static void Main() { int[] arr = { 87, 92, 45, 65, 34, 88 }; Console.WriteLine(arr.Average()); Console.WriteLine(arr.Count()); } }
output
68.5 6
Advertisements