Just come across the following line of code and having a hard time finding documentation for it, is it a lambda expression? What does this do?
temp = Regex.Replace(url, REGEX_COOKIE_REPLACE,match => cookie.Values[match.Groups["CookieVar"].Value]);
Specifically interested in the =>.
If you look at the documentation for Replace, the 3rd argument is a
MatchEvaluator:http://msdn.microsoft.com/en-us/library/system.text.regularexpressions.matchevaluator.aspx
This is a delegate that takes a
Matchas an argument and returns the string to replace it with. Your code is defining aMatchEvaluatorusing a lambda expression:Here, for each match that the Regex finds, a value is being looked up in the
cookie.Valuesdictionary and the result is being used as the replacement.