struct Block
{
public int Id { get; private set; }
public int Time { get; set; }
public Block(int id, int time) : this() { Id = id; Time = time; }
}
using System;
namespace Skyiv.Ben.Test
{
struct Block
{
public int Id { get; private set; }
public int Time { get; set; }
public Block(int id) : this() { Id = id; }
}
sealed class Test
{
static void Main()
{
Console.WriteLine(new Block(37).Time);
}
}
}
接著將在 Windows (csc.exe) 與 Linux (gmcs) 分別編譯並比較 IL 代碼。