Last active
December 14, 2015 03:48
-
-
Save hmemcpy/5023336 to your computer and use it in GitHub Desktop.
Who knew static initializers depend on the order?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static readonly string[] MyPaths = GetAllPaths("path1", "path2"); | |
static readonly string[] AllExtensions = new[] { ".htm", ".html", ".sshtml" }; | |
private static string[] GetAllPaths(params string[] viewLocations) | |
{ | |
// this will throw a NRE since AllExtensions is null! | |
return viewLocations.SelectMany(view => AllExtensions.Select(extension => view + extension)).ToArray(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment