Sunday, February 20, 2011

Generic Constraints

class SortedList where T: IComparable , new()
{...}

In C# we have generic constraints like this to indicate a where clause to which the class must comply.

Here sortedlist is using a type T. This type must implement the Icomparable interface. The new() states that the type T must have a constructor.

No comments:

Post a Comment

Retrieving Calendar of a Bookable Resource in Dynamics

There are occasions where we need to retrieve working days and working times of a resource in Dynamics grammatically. This is quite possible...