问题
I have two files.
File 1:
namespace A
type A1() =
// ....
File 2:
namespace A
type A2() =
// ....
I can use A1 and A2 types in File 2, but I can see only A1 in File 1. I think it is because compiler don't know about A2 when it is parsing File 1.
Is there any way to make something like forward type declaration in this case ? Or to change the order of parsing the source files by compiler. It will be enough for me to have A1 and A2 in File1, and only A2 in File1.
Update:
I believe it is not dublicate of this question. I know about and
keyword in the type declaration, but I can not merge two different files in one (See question title).
回答1:
change the order of parsing the source files
This can be done by changing the order of the files in Visual Studio: right-click and Move Up
respectively Move Down
回答2:
If you have the F# Power Tools installed, Alt-UpArrow and Alt-DownArrow also work, IIRC.
来源:https://stackoverflow.com/questions/31086071/forward-type-declaration-with-two-files