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>
yield - contruct return for IEnumerable
e.g.
IEnumerable
{
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