Set size of generic list via script?

I just started using lists and its a bit confusing to me.
How can I set the size of my list? Count is read only and Capacity doesn’t do it either.
With arrays you’d do something like:

array1.length = array2.length;

But how do you do it with generic lists?
I tried:

list1.Capacity = list2.Count;

or

list1 = new List<int>(list2.Count);

and some other variations, but it doesn’t resize it in the inspector;
I can do it manually but I wanna do it via script if possible.

I’ve read through the http://msdn.microsoft.com/en-us/library/6sh2ey19(v=vs.110).aspx but couldn’t find anything that would let me do that.

You don’t explicitly set the size of a List; the size comes from the number of items in it. (Capacity is only for the internal size of the List and something you would rarely if ever use.) If you want a List with a particular number of items you can convert an array to a List.

list1 = new List<int>(new int[list2.Count]);

This page comes up pretty early in searches for how to resize a list. So, here’s my solution — just stick this in a (possibly static) class somewhere, and it adds a Resize(n) method to the generic List.

public static void Resize<T>(this List<T> list, int newCount) {
	if (newCount <= 0) {
		list.Clear();
	} else {
		while (list.Count > newCount) list.RemoveAt(list.Count-1);
		while (list.Count < newCount) list.Add(default(T));
	}
}