Windows Phone Developers

Wednesday, December 23, 2009

Cannot implicitly convert type 'System.Diagnostics.Process[]' to 'System.Diagnostics.Process'

The compiler requires an explicit conversion. For example, you may need to cast an r-value to be the same type as an l-value. Or, you must provide conversion routines to support certain operator overloads.

Process oProcess;

oProcess = Process.GetProcessesByName(sProcessName);

Since GetProcessesByName creates an array of new Process components and associates them with the existing process resources that all share the specified process name, we need to declare oProcess as shown below:

Process[] oProcess;

oProcess = Process.GetProcessesByName(sProcessName);

C# Error Cannot implicitly convert type 'System.Diagnostics.Process[]' to 'System.Diagnostics.Process', .NET Error Cannot implicitly convert type 'System.Diagnostics.Process[]' to 'System.Diagnostics.Process'

Digg Technorati Delicious StumbleUpon Reddit BlinkList Furl Mixx Facebook Google Bookmark Yahoo
ma.gnolia squidoo newsvine live netscape tailrank mister-wong blogmarks slashdot spurl StumbleUpon

No comments:

Post a Comment