- Home /
error CS0103 How do you fix this?
Hi please can someone help me with my problem. Im scripting a PerlinNoise in C# and i cant find a way to fix this error that keeps occouring. The Error is "The type or namespace name `T' could not be found"
"public static T[][] GetEmptyArray (int width, int height)"
complete script below
public class PerlinNoise { static Random random = new Random();
// Tools public static T[][] GetEmptyArray (int width, int height) { T[][] image = new T[width][];
for (int i = 0; i < width; i++) { image[i] = new T[height]; } return image; }
Please format your code correctly. Currently, it's impossible to help you as your code sample reads like nonsense.
DIY: What are the c# error messages? Also provide formatted code (using 101010 button) and provide the line number where the error is occurring.
The problem is that you use T
as data type and it is not defined. You should either use actual data type (like int
) or create generic method, like so: public static T[][] GetEmptyArray(int width, int height) where T : struct, IComparable
Your answer
Follow this Question
Related Questions
error CS0103: The name `wing' does not exist in the current context 2 Answers
Different Explosion for Different Collisions 3 Answers
I'm wondering with if function working 2 Answers
MouseLook half disabling 1 Answer
Trouble getting if statement to work 2 Answers