TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Sie Ste
NA
196
184.4k
C# process code
Sep 6 2012 4:15 PM
I have questions to ask about the following C# 2008/2010 code listed below:
Process eProcess = new Process();
eDataContext rData = new eDataContext();
string[] PkgIDs = rData.Trans.Select(c => c.Package_ID ).ToArray();
foreach (string PkgID in PkgIDs)
{
eProcess.StartInfo.FileName = "app1.exe";
eProcess.StartInfo.Arguments = "10 " + " 5" + PkgID;
eProcess.Start();
eProcess.WaitForExit();
eProcess.Close();
}
My questions are the following:
1. After the eProcess.WaitForExit(); line of code is finished waiting for the process to finish executing, is there a way to check for the condition code returned from the run. I basically want to see if the job that executed ran successfully. If so, can you tell me how to setup that code?
2. Do I need the line of code "eProcess.Close();"/ Why or why not?
3. I am basically looping thoough calls executing a process based upon values received in PkgID that is stored in a database table. Is this code good or not? Can you tell me why or why not? If the code is not good, can you tell me a better way to
write the code?
Reply
Answers (
5
)
C# config files
Casting