C#/.Net Project Cluster Other new C# 2.0 features and Simple …
Short Description
New in C# 2.0: Partial type declarations (C# Precisely section 26). In C# 2.0, a class, interface or struct may be declared in several parts, contained in …
Website: www.itu.dk | Filesize: 46kb
Content
C#/.Net Project Cluster
Other new C# 2.0 features
and
Simple WinForms user interfaces
Peter Sestoft
KVL and IT University of Copenhagen
ITU May 2006 C#/.Net Project Cluster C# 2.0 News-1
C#/.Net project cluster
Wednesday 3 May 2006
Iterators: the yield statement.
Partial types
Anonymous methods: delegate expressions.
SQL-style nullable value types: int?, bool?, and so on.
Graphical user interfaces (GUIs) with WinForms.
ITU May 2006 C#/.Net Project Cluster C# 2.0 News-2
New in C# 2.0: Anonymous methods: delegate expressions (C# Precisely section 12.20)
Advanced API’s often have methods that take delegates as arguments, for instance:
class IntList {
public IntList Filter(IntPredicate p);
…
}
delegate bool IntPredicate(int x);
The Filter method may return a list containing only those elements x for which p is true.
We can define a method Even that is true for even integers, make a delegate, and apply Filter to it:
static bool Even(int x) { return x%2 == 0; }
…
list.Filter(Even);
C# 2.0 allows us to define Filter’s delegate argument inline, as an anonymous method:
list.Filter(delegate(int x) { return x%2…
Get the file Download here
Related Books:Related Searches: graphical user interfaces, type declarations, anonymous method, cluster c, university of copenhagen
Comments
Leave a Reply