[英]How do I import existing c# file into web application
I'm building a simple 1 page web interface that needs to be able to interact with a C# file I wrote as a "Universal Windows" application.我正在构建一个简单的 1 页 Web 界面,该界面需要能够与我作为“通用 Windows”应用程序编写的 C# 文件进行交互。
I'm new to .net and C#, is there any way to import the file so i have access to the methods or will I have to rewrite it in the web developer?我是 .net 和 C# 的新手,有什么方法可以导入文件,以便我可以访问这些方法,还是必须在 Web 开发人员中重写它? Also, what is the best "web application" to use in visual studios to accomplish what I am trying to do?另外,在视觉工作室中使用什么来完成我想要做的最好的“网络应用程序”是什么?
Thanks.谢谢。
If the file resides in the same project and different namespace then you can add the Using statement at the top of your code for the namespace in which your c# file resides.如果文件位于同一个项目和不同的命名空间中,那么您可以在代码顶部为 c# 文件所在的命名空间添加 Using 语句。 like :喜欢 :
using System.IO;
This will give access to all the public classes under the namespace System.IO.这将允许访问命名空间 System.IO 下的所有公共类。
You will need to use ASP.NET Web Application to achieve this.您将需要使用 ASP.NET Web 应用程序来实现这一点。 You can either choose web forms or MVC depending on your requirement.您可以根据需要选择 Web 表单或 MVC。
Please visit ASP.NET Site for more information.请访问ASP.NET 站点以获取更多信息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.