/// <summary> /// Action实例 /// </summary> public static void ActionTest() { var bll = new TestEntity.BLL.Person(); TestEntity.Models.Person p = new TestEntity.Models.Person() { Age = 11, Name = "张", Balance = 100 }; TestTool.SetPersonAction(p, (m) => { m.Name += "哒哒"; }); TestTool.SetPersonAction((() => Console.WriteLine("哈哈哈"))); Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(p)); }
/// <summary> /// Func实例 /// </summary> public static void FuncTest() { var bll = new TestEntity.BLL.Person(); TestEntity.Models.Person p = new TestEntity.Models.Person() { Age = 12, Name = "郑格", }; TestTool.SetPersonFunc(() => { return("Func 执行ing ……"); }); p.SetPersonFunc(m => { return("姓名:" + m.Name + ",年龄:" + m.Age.ToString()); }); string msg = "我是如来佛祖玉皇大帝观音菩萨指派取西经特派使者花果山水帘洞美猴王齐天大圣孙悟空啊!帅的掉渣!"; msg.PredicateTest(s => { return(s.Length > 30); }); }