Animation Names in Array? (C#)

I’m trying to get all the animations of a certain GameObject into an Array using C#, but I can’t seem to figure out how to loop through the animations and adding them to my array… I’m trying to use this for a custom editor I’m working on for my game (will use the array to create a dropdown list…)

Here’s my code:

	int GetAnimations(Animation anim)
	{
		int AnimCount = anim.GetClipCount();
		return AnimCount;
	}
	
	string[] GetAnimationNames(Animation anim)
	{
		string[] tmpList;
		int count = GetAnimations (anim);
		
		tmpList = new string[count];
		
		for(int i = 0; i < count; i++)
		{
			tmpList[i] = ?????
		}

		return tmpList;
	}
count = 0;
foreach(AnimationState st in anim){
 tmpList[count] = st.name;
count++
}