OSDN Git Service

Merge branch 'master' of git.sourceforge.jp:/gitroot/psychlops/silverlight
[psychlops/silverlight.git] / dev4 / psychlops / core / graphic / module.cs
index db366c1..6adecfd 100644 (file)
@@ -4,6 +4,48 @@ using System.Windows;
 \r
 namespace Psychlops\r
 {\r
+       public static class StaticFunctions\r
+       {\r
+               public static T[] NewArray<T>(int x)\r
+                       where T : new()\r
+               {\r
+                       T[] t = new T[x];\r
+                       for (int i = 0; i < x; i++)\r
+                       {\r
+                               t[i] = new T();\r
+                       }\r
+                       return t;\r
+               }\r
+               public static T[,] NewArray<T>(int x, int y)\r
+                       where T : new()\r
+               {\r
+                       T[,] t = new T[x,y];\r
+                       for (int i = 0; i < x; i++)\r
+                       {\r
+                               for (int j = 0; j < x; j++)\r
+                               {\r
+                                       t[i,j] = new T();\r
+                               }\r
+                       }\r
+                       return t;\r
+               }\r
+               public static T[,,] NewArray<T>(int x, int y, int z)\r
+                       where T : new()\r
+               {\r
+                       T[,,] t = new T[x, y, z];\r
+                       for (int i = 0; i < x; i++)\r
+                       {\r
+                               for (int j = 0; j < y; j++)\r
+                               {\r
+                                       for (int k = 0; k < z; k++)\r
+                                       {\r
+                                               t[i, j, k] = new T();\r
+                                       }\r
+                               }\r
+                       }\r
+                       return t;\r
+               }\r
+       }\r
 \r
        public partial struct Point\r
        {\r