GGEZ's C# Style Guide

What’s up with your coding style?

When you download a GGEZ asset, you’ll probably notice I use a pretty unique code style. My style is derived from Whitesmiths and solves a number of practical issues with other coding styles I’ve used over the last 20 years.

Here’s a sample:

namespace ggez
{
public struct Vector2i
{
public int X;
public int Y;

public Vector2i (
        int x,
        int y
        )
    {
    this.X = x;
    this.Y = y;
    }

public override bool Equals (object other)
    {
    var otherThisType = other as Vector2i;
    if (otherThisType == null)
        {
        return false;
        }
    return otherThisType.x == this.x
            && otherThisType.y == this.y;
    }
}
}

Principles

Basic Rules

Functional Style Goals

Exceptions

alt text