Question: I have a list of Vector3, each with x,y,z values.

```
List<Vector3> list = new List<Vector3>();

```

I would like to iterate through this list, and find the average and create a vector from it:

resultant vector: 

```
averageVector.X = average of all the x values;
averageVector.Y= average of all the y values;
averageVector.Z = average of all the z values;

return averageVector;

```

I'm trying to create a function for this, and would love your help!

Answer: 
You can use `Enumerable.Aggregate` to sum up the vectors, then just divide by the count to get the average.

```
var average = list.Aggregate(new Vector3(0,0,0), (s,v) => s + v) / (float)list.Count;

```
A modern code way to solve this is using a Unity `Bounds` axis-aligned bounding box.

Code looks like this:

```
var bounds = new Bounds(Vector3.zero, Vector3.zero);
list.ForEach(v => bounds.Encapsulate(v));
return bounds.center;

```