public static bool IsType <T>(this Container2D <T> cont, int x, int y, GridType type) where T : IGridSpace { T space; if (cont.TryGetValue(x, y, out space)) { return(type.Equals(cont[x, y].GetGridType())); } return(type == GridType.NULL); }