将用于识别应用程序类型的VB.NET预处理程序指令转换为C#预处理程序指令 [英] Convert VB.NET Preprocessor directive for recognizing type of application to C# Preprocessor directive
本文介绍了将用于识别应用程序类型的VB.NET预处理程序指令转换为C#预处理程序指令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
VB.NET在某个位置有一个名为_MyType的变量,用于指示应用程序类型.其中之一是"WindowsForm".
因此,在DLL中vb表示:
#如果_MyType ="WindowsForm",则
...
#endif
如何确定Windll或WebApp或ConsoleApp在C#中是否正在调用此dll?
抱歉,我之前输入了错误的问题.
VB.NET has a variable some place called _MyType that indicates the application type. One of them is "WindowsForm".
So, in the DLL vb says:
#If _MyType = "WindowsForm" then
...
#endif
How do I determine if this dll is being called by a WinApp or WebApp or ConsoleApp in C#?
Sorry I asked the wrong question before.
推荐答案
我不认为VB.NET具有预定义的符号_MyType.您正在使用的项目或第三方资源库可能已通过其项目设置完成了此操作.
为了在C#中进行模拟,您将必须手动执行相同的操作.在所有Winforms项目中定义WindowsForms,在所有控制台项目中定义控制台,在所有Web项目中定义WebApp,等等.
I don''t think VB.NET has a predefined symbol called _MyType. The projects you are using, or perhaps a 3rd party source library, may have done that through their project settings.
To simulate that in C# you will manually have to do the same. Define WindowsForms in all your Winforms projects, Console in all your console projects, WebApp in all your web projects, etc.
这篇关于将用于识别应用程序类型的VB.NET预处理程序指令转换为C#预处理程序指令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文