# how to create a matrix in C#?

So I know how to make a matrix in java using something such as `String [][] stringTester = {{"words", "moreWords","Yeet"},{"idk","yetMoreWords"},{"sup","ladys"}}; System.out.print(stringTester[0][2]);`

which in terms should print out "Yeet" but what would be the C# equivalence? (IK IK THIS IS JAVA, but i need to use matrix using c# for my game using this type of method)

The trick, as Erethan notes, is that C# is a regular, popular, computer language, that Unity just happens to also use.

Obviously, things like changing a gameObject's color are Unity-specific, but for 90% of what you want to know, you can just Search "C# thingYouWantToKnow" and get a really nice explanation - much better than you'd get here, since C# is much older and has many, many more users.

**Answer** by Erethan
·
Jan 24, 2017 at 12:40 AM

These are called jagged array (at least in C# as far as I know)

The msdn doc is quite clear:

https://msdn.microsoft.com/en-us/library/2s05feca.aspx

You also might be interest in Multi-dimensional arrays (This would be closer to a matrix):

They are in general called jagged arrays, even in Java^^. Matrix is actually a mathematical term and generally means a rectangular two dimensional array of numbers.

Jagged arrays don't have to be rectangular since each nested array can have a different length, like the example in the question (first as 3 elements the second and third has only two each).

In the field of games and computer graphics you usually don't call an array "a matrix" as there are actual matrices like Unity's `Matrix4x4`

type. However that's a matrix in the mathematical sense.

### Your answer

### Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.