This project is read-only.
1
Vote

Match() doesn't return Tuple

description

Tuple<Crypter,bool> match = crpyterparam.Match()
            .With(s => "64bit" == s, (string s) => Tuple.Create(new _64bit(), true))
            .With(s => "AES"   == s, (string s) => Tuple.Create(new AES(), true))
            .Default(f => Tuple.Create(new _64bit(), false)) 
            .Return<Tuple<Crypter,bool>>();
 
FunctionalCSharp.MatchFailureException: Failed to match: System.Tuple`2[DevLair.Crypto._64bit,System.Boolean]

comments

nCdy wrote Jul 29, 2011 at 6:46 AM

ok, Maybe it's not a but because _64 bit is a sealed of Crypter but not a Crypter.

this fix works :
        Tuple<Crypter,bool> match = crpyterparam.Match()
            .With(s => "64bit" == s, (string s) => new Tuple<Crypter, bool>(new _64bit(), true))
            .With(s => "AES"   == s, (string s) => new Tuple<Crypter,bool>(new AES(), true))
            .Default(f => new Tuple<Crypter, bool>(new _64bit(), false)) 
            .Return<Tuple<Crypter,bool>>();
Thank you for this awesome library :)

wrote Feb 14, 2013 at 1:41 AM