简体   繁体   English

如何将现有的 c# 文件导入 Web 应用程序

[英]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.

相关问题 如何将新的MVC C#项目与现有的Web窗体VB.NET Web应用程序项目集成? - How do I integrate a new MVC C# Project with an existing Web Forms VB.NET Web Application Project? 如何将cs文件添加到现有C#项目? - How do I add a cs file to an existing C# project? 如何将远程 web 主机上的 php 文件中的数据发送到我计算机上的 c# 应用程序? - how do i send data from a php file on a remote web host to a c# application on my computer? 如何将包导入/添加到 C# 脚本文件? - How do I import/add packages to C# script file? 如何将特定的 excel 单元格值导入 C# 中的现有 datagridview 单元格 - How do I import specific excel cell values to existing datagridview cells in C# 如何将在Qt中创建的DLL导入C#应用程序 - How do I import a DLL I created in Qt into a C# application 从Web应用程序导入日志文件,该怎么办? - Import log file from an web application, should I do? 如何将现有的 Vue.js 2 接口集成到现有的 ASP.NET/C# Web 表单应用程序? - How to integrate an existing Vue.js 2 interface to an existing ASP.NET/C# Web forms application? 如何在Visual Studio解决方案C#中添加现有的Crystal报表文件 - How do I add existing crystal report file in Visual Studio solution C# 如何将C .DLL文件导入C#Windows窗体应用程序并调用其在标头中定义的函数? - how do you import a C .DLL file to a C# windows form application and call its functions that are defined in headers?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM