扩展方法
扩展一个返回值为V3类型的方法, 参数就是需要扩展的类型
public static Vector3[] ToVector3Arrar(this List<Point> pointLst)
{
Vector3[] v3s = new Vector3[pointLst.Count];
for (int i = 0; i < pointLst.Count; i++)
{
v3s[i] = new Vector3(pointLst[i].x, pointLst[i].y, 0);
}
return v3s;
}
List<Point> test = new List<Point>();
test.ToVector3Arrar();
只要对象是该参数类型,就能点出此扩展方法。