C# 2.0 syntax reference

readonly - member variable of class where can only be initialized once in constructor.

yield - contruct return for IEnumerable

e.g.

IEnumerable GetNumbers()
{
yield return 1;
yield return 2;
yield return 3;
yield return 4;
yield break;
}

This is return a 1,2,3,4 list.





this() - calling class constructor



this[] - [] operator override

e.g

public int this[int i]
{
get
{
return 1;
}

}



generic programming

//where TbaseClass is use for T calling function
class C1<T>:D1 where T:TbaseClass

class B1 : C1<myInherittedTbaseClass>

Comments

Popular posts from this blog

Clearcase check in/uncheck out all the checked out files script

MSSQL GROUP_CONCAT

Duplicating a local copy of project from TFS and making web software client factory to work