Operator Overloading
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, to keep the struct immutable.
return new MyPoint(a.X + b, a.Y + b);
}
}
Predicates
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);
}
You May Also Like

Exam 70-536 Study Notes
My study notes for Microsoft exam 70-536: .NET types, collections, generics, I/O, serialization and more, with C# examples.

Starting Exam 70-536 Study
After a burnout, I'm putting my own project on hold to study for Microsoft exam 70-536.

Design Patterns - Proxy Pattern
The Proxy Pattern, and the last article in the design patterns series, now that I've finished reading Head First Design Patterns.




