Skip to content

Instantly share code, notes, and snippets.

@digital-synapse
Created August 24, 2018 17:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save digital-synapse/112af8ded0ea433e552d52ae51bc65fc to your computer and use it in GitHub Desktop.
Save digital-synapse/112af8ded0ea433e552d52ae51bc65fc to your computer and use it in GitHub Desktop.
Helper method for fast multi-dimentional arrays
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
public class Allocate
{
public static T[][][] Array3D<T>(int width, int height, int depth)
{
T[][][] data = new T[width][][];
for (var x = 0; x < width; x++)
{
data[x] = new T[height][];
for (var y = 0; y < height; y++)
{
data[x][y] = new T[depth];
}
}
return data;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment