Total Page Preview:   000000000173

What is IEnumerable in Asp.Net Core MVC in English and Hindi

IEnumerable in English

In ASP.NET Core MVC, IEnumerable is not specific to the framework itself, but rather a fundamental interface provided by the .NET Framework. It is part of the System.Collections namespace and represents a non-generic collection of objects that can be enumerated (iterated) one at a time.

IEnumerable is often used in ASP.NET Core MVC when working with collections of data, such as lists, arrays, or database query results. It provides a way to iterate over the elements of the collection using a foreach loop or LINQ (Language Integrated Query) for querying and manipulating data.
Here's an example of how you might use IEnumerable in an ASP.NET Core MVC controller to return a collection of objects to a view:
In this example, the Index action method returns an IEnumerable<string> to the view, which can then be rendered and displayed in the corresponding Razor view.
The view can iterate over the IEnumerable using a foreach loop or other mechanisms like @foreach in Razor syntax. For example:
This will generate an unordered list (<ul>) with list items (<li>) for each item in the IEnumerable<string>.
In summary, IEnumerable is a common interface used for working with collections of data in ASP.NET Core MVC applications, allowing you to iterate over and manipulate data efficiently.

IEnumerable in Hindi

ASP.NET Core MVC mein IEnumerable ek C# language ka data type hai jo collection of objects ko represent karta hai aur enumeration (iteration) ke liye use hota hai. Ye collection of objects ko ek aise tarike se represent karta hai jise aap ek ek karke access kar sakte hain.
Ye System.Collections namespace mein mojud ek interface hai aur commonly used hota hai jab aap data collections ke sath kaam karte hain, jaise ki lists, arrays, ya database query results. Iska upayog data collections ko enumerate (iterate) karne ke liye foreach loop ya LINQ (Language Integrated Query) ke sath data query aur manipulation ke liye hota hai.
Yahan ek example diya gaya hai jismein ek ASP.NET Core MVC controller mein IEnumerable ka upayog kiya gaya hai, jisse ek collection of objects ko view mein return kiya jata hai:
Is example mein, Index action method ek IEnumerable<string> ko view mein return karta hai, jo fir corresponding Razor view mein render aur display kiya ja sakta hai.
View foreach loop ya Razor syntax mein @foreach ka upayog karke IEnumerable par iterate kar sakti hai. Jaise ki:
Isse <ul> (unordered list) generate hota hai, jisme har item ko <li> (list item) ke roop mein display kiya jata hai.
Saaransh mein, IEnumerable ASP.NET Core MVC applications mein data collections ke sath kaam karne ke liye ek aam interface hai, jo aapko data ko efficient tarike se iterate aur manipulate karne ki anumati deta hai.



Thank You

About Author

Brijesh Kumar

Database Developer

I have more then 6 years Experience in Microsoft Technologies - SQL Server Database, ETL Azure Cloud - Azure SQL Database, CosmosDB, Azure Data Factory, PowerBI, Web Job, Azure Function, Azure Storage, Web Apps, Powershall and Database Migration On-Premise to Azure Cloud.
LinkedIn :





Facebook User: