本文介绍了传递参数从C#控制台应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要运行从另一个C#应用程序,如何加载和放大器的控制台应用程序;传递参数,以便执行控制台应用程序从我的C#应用程序控制台应用程序。
是System.Diagnostics.ProcessStartInfo会有帮助吗?
i need to run console applications from another c# application,how to load & pass arguments to console application from my c# application in order to execute the console application.is System.Diagnostics.ProcessStartInfo will help?
推荐答案
使用的ProcessStartInfo类
Use ProcessStartInfo class
ProcessStartInfo p = new ProcessStartInfo();
p.Arguments = "your arguments";
p.FileName = "Application or Document Name";
Process.Start(p);
public IList<string> GetMatchingWords(string word)
{
var list = new List<string>();
int levelDepth = 0;
if (string.IsNullOrEmpty(word))
return list;
var tempWord = word[0];
var firstNode = RootNode.Childs.FirstOrDefault(x => x.Word[0].Equals(tempWord));
if (firstNode == null)
{
return list;
}
var nodePath = new Queue<TrieNode>();
var sb = new StringBuilder();
sb.Append(firstNode.Word);
while (firstNode != null)
{
levelDepth++;
if (levelDepth == word.Length)
{
break;
}
tempWord = word[levelDepth];
firstNode = firstNode.Childs.FirstOrDefault(x => x.Word[0].Equals(tempWord));
sb.Append(firstNode.Word);
}
if(firstNode!=null)
nodePath.Enqueue(firstNode);
originalValue = sb.ToString();
while (nodePath.Any())
{
var tempNode = nodePath.Dequeue();
tempNode.IsParentNode = true;
PopulateWords(tempNode, sb, ref list);
}
return list;
}
private void PopulateWords(TrieNode node,
StringBuilder sb,ref List<string> list)
{
if (node.Childs.Any())
{
foreach (var temp in node.Childs)
{
if (node.IsParentNode)
{
sb.Clear();
sb.Append(originalValue);
}
if (temp.Childs.Any())
{
sb.Append(temp.Word);
PopulateWords(temp, sb, ref list);
}
else
{
sb.Append(temp.Word);
list.Add(sb.ToString());
}
}
}
else
{
list.Add(sb.ToString());
}
}
这篇关于传递参数从C#控制台应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!