.NET Core 2.0 By Example
上QQ阅读APP看书,第一时间看更新

File sequence

The order of files in a project matters in an F# solution. The file used in any function should be placed above the file where the function is used, because F# has a forward-only model of compilation.

Unlike C#, where the file sequence doesn't matter, the sequencing of files does matter in F#. For example, consider that Program.fs is using DotNetCorePrint.fs. So, DotNetCorePrint.fs should be placed above Program.fs in the solution; otherwise, it will throw a compilation error. To move a file up or down, we can right-click on the file and select Move Up or the keys Alt + the up arrow to move the file. The ordering of the files in Solution Explorer can be seen in the following screenshot: