struct MyPoint { private int _x; private int _y; public int X { get { return this._x; } } public int Y { get { return this._y; } } public MyPoint(int x, int y) { this._x = x; this._y = y; } public static MyPoint operator +(MyPoint a, int b) { // Returns a new object, conform to the immutability. return new MyPoint(a.X + b, a.Y + b); } }
static void Main(string[] args) { int[] ar = { 3, 1, 2 }; Console.WriteLine(Array.TrueForAll<int>(ar, new Predicate<int>(Check))); // Returns False } static bool Check(int target) { return (target == 3); }