Forward type declaration with two files

戏子无情 提交于 2019-12-12 03:33:53

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!