using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ActionTest : MonoBehaviour {
// Use this for initialization
void Start () {
List<Vector3> vlist = new List<Vector3>();
vlist.Add(new Vector3(3, 1, 6));
vlist.Add(new Vector3(4, 1, 6));
vlist.Add(new Vector3(5, 1, 6));
vlist.Add(new Vector3(6, 1, 6));
vlist.Add(new Vector3(7, 1, 6));
Debug.Log("匿名方法");
vlist.ForEach(delegate (Vector3 obj)
{
Debug.Log(obj.normalized.ToString());
});
Debug.Log("lambda表达式");
vlist.ForEach(obj => Debug.Log(obj.normalized.ToString()));
}
// Update is called once per frame
void Update () {
}
}
C#lambda表达式基本使用
最新推荐文章于 2022-03-26 23:13:18 发布