18.11.08

C# Cheat Sheet Cache

As described here, this is a cache/cheat sheet of commonly forgotten (and thus Googled) details for the C# language.

Category Item Sample Notes
Anonymous Delegate/Method Inline Syntax

delegate(int i) { return 0.0; }

Creates a delegate that takes an int and returns a double.
Anonymous Delegate/Method Sort List<T>

List<int> lst = new List<int>();

lst.Sort(

delegate(int i1, int i2)

{

    return i1.CompareTo(i2);

});

Sorts a templated list using an inline function that shares the local scope.

0 comments:

Post a Comment