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

Outlook : "operation failed, object could not be found. " when trying to close a PST.

How to transfer app and data from old iPhone to new iPhone for model IOS17 and IOS18 above.

Troubleshooting Outlook Express (IMAP, POP3, HTTP, NEWS) with the log file