Sorting a List of Products by Price
📖 Scenario: You work in a store and have a list of products with their prices. You want to show the products sorted by their price from lowest to highest.
🎯 Goal: Build a small program that creates a list of products with prices, then sorts them by price using OrderBy, and finally prints the sorted list.
📋 What You'll Learn
Create a list of products with exact names and prices
Create a variable to hold the sorted products using OrderBy
Use a foreach loop to print each product name and price
💡 Why This Matters
🌍 Real World
Sorting products by price helps customers find cheaper or more expensive items easily in online stores or inventory systems.
💼 Career
Sorting and ordering data is a common task in software development, especially in e-commerce, data analysis, and user interface design.
Progress0 / 4 steps