"景先生毕设|www.jxszl.com

C# Action类代码示例

2023-12-29 16:58编辑: www.jxszl.com景先生毕设
本文整理汇总了C#中Action类的典型用法代码示例。如果您正苦于以下问题:C# Action类的具体用法?C# Action怎么用?C# Action使用的例子? 这里精选的类代码示例或许可以为您提供帮助。 示例1: PosTest1 public bool PosTest1() { bool retVal = true; TestLibrary.TestFramework.BeginScenario("PosTest1: The generic type is int"); try { int[] iArray = { 1, 9, 3, 6, -1, 8, 7, 1, 2, 4 }; List listObject = new List(iArray); MyClass myClass = new MyClass(); Action action = new Action(myClass.sumcalc); listObject.ForEach(action); if (myClass.sum != 40) { TestLibrary.TestFramework.LogError("001", "The result is not the value as expected,sum is: " + myClass.sum); retVal = false; } } catch (Exception e) { TestLibrary.TestFramework.LogError("002", "Unexpected exception: " + e); retVal = false; } return retVal; }
原文链接:http://www.jxszl.com/biancheng/C/556463.html