For the record, I agree with everyone that a Dictionary is probably more appropriate. But you can write a little method to pull off what you want:
public static T[] CreateArray<T>(params Tuple<int, T>[] values)
{
var sortedValues = values.OrderBy(t => t.Item1);
T[] array = new T[sortedValues.Last().Item1 + 1];
foreach(var value in sortedValues)
{
array[value.Item1] = value.Item2;
}
return array;
}
And call it like this:
string[] myArray = CreateArray(new Tuple<int, string>(34, "cat"), new Tuple<int, string>(12, "dog"));
If C# receives the syntactic sugar for Tuple that many people seem to want, this would get a tad cleaner looking.
Is this a good idea? Almost certainly not, but I'll leave that for the OP to judge.