04-23-2012, 06:33 AM
(This post was last modified: 04-23-2012, 06:35 AM by AceInfinity.)
I thought it would be fun to post a little small challenge for others
The challenge here is to explain (as best as possible) how my snippet of code here works:
Maybe you'll learn something from it also? If so, then that is not a bad thing. It's not too hard to figure out if you don't look at it as one piece, break it up and follow the logic. The better you explain it, the more I can appreciate your reply to this challenge, as anybody can run this and tell me what the result is, but maybe only some people here can explain what it's doing
The challenge here is to explain (as best as possible) how my snippet of code here works:
Code:
Func<string, bool> f_sb = x => x.All(c => char.IsNumber(c));
string[] input = {"abc", "ABC", "sdf", "23b", "3a4", "521", "aaa", "642", "lkj", "243"};
Console.WriteLine(input.Where(x => f_sb.Invoke(x)).ToArray().Aggregate((a, b) => a + b));
Maybe you'll learn something from it also? If so, then that is not a bad thing. It's not too hard to figure out if you don't look at it as one piece, break it up and follow the logic. The better you explain it, the more I can appreciate your reply to this challenge, as anybody can run this and tell me what the result is, but maybe only some people here can explain what it's doing