Declaring a large number of 2D arrays to be used as 2D graphic sprites I'm creating a Space Invaders game, and graphics sprites in it are defined as 2D arrays of colors. 

It seems like it's going to be cumbersome declaring these arrays the way I currently am:

//This creates an inverting red/blue cross animation
public Sprite myFirstAnimation()
{
    Sprite frame1 = new Sprite(new Color[,]
                    {{Color.Red, Color.Blue, Color.Red}, 
                        {Color.Blue, Color.Blue, Color.Blue},
                        {Color.Red, Color.Blue, Color.Red}});

    Sprite frame2 = new Sprite(new Color[,]
                    {{Color.Blue, Color.Red, Color.Blue}, 
                        {Color.Red, Color.Red, Color.Red},
                        {Color.Blue, Color.Red, Color.Blue}});

    AnimatedSprite myAnimatedSprite = new AnimatedSprite(new Sprite[] { frame1, frame2 });
    return myAnimatedSprite; 
}


Can you point me the the direction for a nicer way of doing this, as to make it more maintainable and readable, and less arduous?
You're trying to store data in code. While that is not bad idea by itself, you shouldn't overuse it and I think that's what you're doing here.

If your data is bitmaps, store them in some bitmap format (BMP or maybe PNG) and then load them into your program from that. As an additional advantage, you will be able to edit your images using normal image editing software (like Paint), instead of having to edit your code.

If you want to keep having your bitmaps in code, you want to decrease the verbosity and you're willing to lose some type-safety, you could encode your bitmaps as strings and then transform them into 2D array using a helper function.

It could look something like:

Color[,] frame1 = FormatMatrix("010 111 010", Color.Red, Color.Blue);


Or even:

Color[,] frame1 = FormatMatrix(@"
010
111
010", Color.Red, Color.Blue);


The helper function would look something like this:

static T[,] FormatMatrix&lt;T&gt;(string format, params T[] values)
{
    var formatParts = format.Split(new char[0], StringSplitOptions.RemoveEmptyEntries);

    T[,] result = new T[formatParts.Length, formatParts[0].Length];

    for (int i = 0; i &lt; formatParts.Length; i++)
    {
        var formatPart = formatParts[i];

        for (int j = 0; j &lt; formatPart.Length; j++)
        {
            if (formatPart[j] &gt;= '0' &amp;&amp; formatPart[j] &lt;= '9')
                result[i,j] = values[formatPart[j] - '0'];
            else
                throw new ArgumentException("format");
        }
    }

    return result;
}