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
dc
NA
663
0
C# working with a called process
Oct 4 2012 12:07 AM
In a C# 2008 application, I have a foreach loop that is listed below:
for each (PkgID in PkgIDs)
{
Process eProcess = new Process();
String Process_Arguments = null;
eProcess.StartInfo.UseShellExecute = false;
eProcess.StartInfo.FileName = strConsoleAppLocation;
Process_Arguments = filedirectorypath + " 7654" + PkgID;
eProcess.StartInfo.Arguments = Process_Arguments;
eProcess.Start();
eProcess.WaitForExit(1800);
eProcess = null;
Process_Arguments = null;
}
As you can see from the code I listed above I have the following questions:
1. For each iteration of the for loop I create a new process object
called eProcess and then I set eProcess = null; near the end of the loop.
Thus can you tell me if this is code or not and why? If you have better
code that I could use would you tell me what you recommend by pointing
me to some code I can use as a reference??
2. You can see that I also have the following line of code,
eProcess.WaitForExit(1800);
I have this line since the process that is being called does not seem to
complete its processing before the control is returned to this program.
Thus can you tell me the following:
a. Is the number of milliseconds that I specify a good amount? Can you tell
me why or why not?
b. Since the code is returned to this calling program before the entire
eProcess finished, can you tell me if this is a good way to wait for
the eprocess to finish? I would think there is a better way to
what for eProcess to finish. If so, is there a way to tell when the eProcess
is really finished executing?
Reply
Answers (
1
)
Case insensitive search
how can i create a monthly income report for a communication