如何组合2个控制台应用程序 [英] How do I combine 2 console applications

查看:69
本文介绍了如何组合2个控制台应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有2个控制台应用程序,我单独输出可以在同一页面上运行两个应用程序??如

如果我们输入1:输出1个程序

如果我们输入2:输出第2个节目



如果可能的话请解释这个问题。??



我尝试了什么:



这不是单行输出程序,每个程序都有输入和输出选项

i have 2 console applications which i get output separately can i run both the applications on same page ??like
if we enter 1: output of 1 program
if we enter 2 : output of 2 nd program

if possible please explain the peocedure .??

What I have tried:

this is not a single line output program ,every program has again input and output options

推荐答案

昨天你问了一个类似的问题:我们可以将控制台应用程序转换为C#中的Web应用程序 [ ^ ]它是关于一个你还没有工作的应用程序(因为你还在在一小时前提问。)

有两个,它变得越来越糟,特别是当你想在网页中运行它们时 - 你无法从网页或服务器上启动客户端上的应用程序 - 或者恶意网站会杀死或感染每台机器接近他们 - 所以应用程序必须在服务器上运行。而且由于你需要每个程序都有输入和输出选项,我给你的最后一个问题的建议仍然适用:坐下来,找出UI应该是什么,并为新环境重新创建应用程序。你正在快速接近任何其他方法将给你做更多的工作,而不是拯救你,以及几乎无法维护。
When you asked a similar question yesterday: Can we convert console application in to web application in C#[^] it was about a single application, which you haven't got working yet (since you were still asking questions under an hour ago).
With two, it's getting worse, particularly when you want to run them "in a web page" - you cannot start apps on the client from a web page, or from the server - or malicious sites would kill or infect every machine that approached them - so the apps would have to run at the server. And since you need that "every program has again input and output options" the advice I gave you for the last question still applies: sit down, and work out what the UI should be, and recreate the app for the new environment. You are fast approaching the point where any other approach is going to give you more work to do than it could ever save you, as well as being next to impossible to maintain.


嗯,



每个应用程序都有一个入口点。在控制台应用程序的情况下,这将是Main(string [] args)方法。

就像Highlander一样,只能有一个!



但是,您可以将控制台应用程序用作引用的资源。最简单的例子是在同一个项目中同时拥有两个控制台应用程序,以及第三个访问控制台应用程序,它们引用前两个应用程序中的每一个。新的访问应用程序必须使用两个引用的应用程序方法。



为此准备两个控制台应用程序的最佳方法是每个应用程序几乎没有任何内容他们的主要方法。 Main只运行另一个可以通过访问控制台应用程序访问的公共方法。



我希望有意义
Well,

Every application has a single "Entry Point". In the case of console applications this will be the Main(string[] args) method.
Just like the Highlander, there can only be one!

You can, however, use console applications as referenced resources. The simplest example would be to have both console applications in the same project and a third "access" console app which references each of the two previous apps. The new "access" app will have to use the two referenced apps methods.

The best way to prepare the two console apps for this is to have almost nothing in each of their Main methods. Main just runs another public method that can be accessed by the "access" console app.

I hope that makes sense


这篇关于如何组合2个控制台应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆