using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.IO.IsolatedStorage;
using Microsoft.Phone.Controls;
namespace Car类
{
public partial class MainPage : PhoneApplicationPage
{
// Constructor
public MainPage()
{
InitializeComponent();
}
private void myFirstButton_Click(object sender, RoutedEventArgs e)
{
//Car mynewcar = new Car();
//mynewcar.Make = "oldsmobile";
//mynewcar.Model = "W";
//mynewcar.Year = 1989;
//mynewcar.Color = "Sliver";
Car car1=new Car();
car1.Make="oldsmobile";
car1.Model="W";
car1.Year=1989;
Car car2=new Car();
car2.Make="oldsmobiles";
car2.Model="Ww";
car2.Year=1999;
List<Car> myList = new List<Car>();
myList.Add(car1);
myList.Add(car2);
string myCars="";
foreach(Car car in myList)
{
myCars += car.Make + "--" + car.Model + "--" + car.Year + Environment.NewLine;
}
mytextBlock.Text = myCars.ToString();
}
class Car
{
public string Make { get; set; }
public string Color { get; set; }
public int Year { get; set; }
public string Model { get; set; }
}
}
}