Created
August 24, 2018 17:55
-
-
Save digital-synapse/112af8ded0ea433e552d52ae51bc65fc to your computer and use it in GitHub Desktop.
Helper method for fast multi-dimentional arrays
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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