public class Icecream
{
public string name;
public string ingredients;
public string totalFat;
public string cholesterol;
public string totalCarbohydrates;
public string protein;
public double price;
}
List
icecreamsList = new List
{
new Icecream
{
name="Chocolate Fudge Icecream",
ingredients="cream, milk, mono and diglycerides...",
totalFat="20g",
cholesterol="50mg",
totalCarbohydrates="35g",
protein="4g",
price=10.5
},
new Icecream
{
name="Vanilla Icecream",
ingredients="vanilla extract, guar gum, cream...",
Overview
[ 10 ]
totalFat="16g",
cholesterol="65mg",
totalCarbohydrates="26g",
protein="4g", price=9.80
},
new Icecream
{
name="Banana Split Icecream",
ingredients="Banana, guar gum, cream...",
totalFat="13g",
cholesterol="58mg",
totalCarbohydrates="24g", protein="6g",
price=7.5
}
};
I have created a list, containing details of different ice-creams. Now I can use the
projection or transformation capabilities of LINQ, and create structure and give a
custom shape to something other than the original Icecream object.
Pages:
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