![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
AsQueryable() in C#
AsQueryable() method is used to get an IQueryable reference.
Let us see an example to find sum of integer values.
Firstly, set an integer array.
var arr = new int[] { 100, 200, 300, 400 };
Now to find the sum, use the Queryable Sum() and AsQueryable() method.
Queryable.Sum(arr.AsQueryable());
The following is the complete code.
Example
using System; using System.Linq; class Demo { static void Main() { var arr = new int[] { 100, 200, 300, 400 }; int res = Queryable.Sum(arr.AsQueryable()); Console.WriteLine("Sum: "+res); } }
Output
Sum: 1000
Advertisements