程式碼:
using System;
using System.Collections.Generic;
class TestClass
{
static void Main()
{
var list = new List<Point>();
list.Add(new Point { x=1, y=1 });
list.Add(new Point { x=1, y=2 });
foreach (var item in list)
{
Console.WriteLine("Point->({0},{1})", item.x, item.y);
}
Console.ReadLine();
}
struct Point
{
public int x;
public int y;
}
}
using System.Collections.Generic;
class TestClass
{
static void Main()
{
var list = new List<Point>();
list.Add(new Point { x=1, y=1 });
list.Add(new Point { x=1, y=2 });
foreach (var item in list)
{
Console.WriteLine("Point->({0},{1})", item.x, item.y);
}
Console.ReadLine();
}
struct Point
{
public int x;
public int y;
}
}
沒有留言:
張貼留言