CSharp Pattern Matching 0.1

Rating: No reviews yet
Downloads: 111
Released: Sep 13, 2009
Updated: Sep 13, 2009 by holoed
Dev status: Alpha Help Icon

Recommended Download

Source Code FunctionalCSharp_src_0.1.zip
source code, 228K, uploaded Sep 13, 2009 - 79 downloads

Other Available Downloads

Application FunctionalCSharp_bin_0.1.zip
application, 27K, uploaded Sep 13, 2009 - 32 downloads

Release Notes

This is an alpha release of the Pattern Matching in C# Library.

You can find many examples of how to use this library in the provided unit tests.

One of the best uses is to navigate Linq Expression Trees, like the following:

var Op = new Dictionary<ExpressionType, string> { { ExpressionType.Add, "+" } };

Expression<Func<int,int,int>> add = (x,y) => x + y;

Func<Expression, string> toString = null;
 toString = exp =>
 exp.Match()
    .With<LambdaExpression>(l => toString(l.Body))
    .With<ParameterExpression>(p => p.Name)
    .With<BinaryExpression>(b => String.Format("{0} {1} {2}", toString(b.Left), Op[b.NodeType], toString(b.Right)))
    .Return<string>();

Enjoy,
Edmondo

Reviews for this release

No reviews yet for this release.