1.命名構(gòu)造函數(shù)
class Rect
{
const Rect.posAndSize(this.pos, this.size); //命名構(gòu)造函數(shù)
/// Gets the empty rectangle.
static const empty = Rect.posAndSize(Vec.zero, Vec.zero);
}

c#改寫:可以使用靜態(tài)函數(shù):
public static RoomTile Junction(Direction direction)
{
var rtn = new RoomTile()
{
tile = null,
direction = direction
};
return rtn;
}