Skip to content

Latest commit

 

History

History
24 lines (16 loc) · 443 Bytes

Any.Forward.md

File metadata and controls

24 lines (16 loc) · 443 Bytes

Any.Forward

Get elements sequentially by the specified path.


Deep traversal

Example 1 ( Innermost Exception )

var exception = new Exception("3", new Exception("2", new Exception("1")));
var forwards = Any.Forward(exception, x => x.InnerException);

/*
 * Exception 3      = First
 * - Exception 2
 * - - Exception 1  = Last
 */
Assert.Equal("1", (from ex in forwards select ex).Last().Message);