将用于识别应用程序类型的VB.NET预处理程序指令转换为C#预处理程序指令

编程入门 行业动态 更新时间:2024-10-22 19:35:42
本文介绍了将用于识别应用程序类型的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#预处理程序指令

本文发布于:2023-11-14 00:42:09,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1585751.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:指令   程序   转换为   应用程序   类型

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!