-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIProduct.cs
50 lines (40 loc) · 1.29 KB
/
IProduct.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp1._15thdec.List
{
public class IProduct
{
public int Id1 { get; set; }
public string Name { get; set; }
public int Price { get; set; }
public override string ToString()
{
return $"ID{Id1},name{Name},Price{Price}";
}
static void Main(string[] args)
{
List<IProduct> ll = new List<IProduct>();
ll.Add(new IProduct { Id1 = 200, Name = "Mobile", Price = 40000 });
ll.Add(new IProduct { Id1 = 250, Name = "Watch", Price = 40050 });
ll.Add(new IProduct { Id1 = 290, Name = "Laptop", Price = 45000 });
ll.Add(new IProduct { Id1 = 295, Name = "Mouse", Price = 400});
foreach(IProduct ps in ll)
{
Console.WriteLine(ps);
}
Console.ReadLine();
Console.WriteLine("Price less than 2000rs.......................");
foreach(IProduct ps in ll)
{
if (ps.Price < 2000)
{
Console.WriteLine(ps);
}
Console.ReadLine();
}
}
}
}