System.Diagnostics.Process.ToString C# (CSharp) Method

ToString() public method

public ToString ( ) : string
return string
        public override string ToString() { throw null; }

Usage Example

        public static string GetProcessCommandline(Process process)
        {
            try
            {
                Debug.Write(string.Format("FileName: {0}", process.MainModule.FileName ?? "<NULL>"));
                using (ManagementObjectSearcher searcher = GetProcessSearcherForId(process.Id))
                {
                    foreach (ManagementObject @object in searcher.Get())
                    {
                        string name = @object["CommandLine"] + " ";
                        Debug.WriteLine(string.Format("CommandLine: {0}", name));
                        return name.Trim();
                    }

                    Debug.WriteLine("");
                }
            }
            catch (Win32Exception ex)
            {
                if ((uint)ex.ErrorCode != 0x80004005)
                {
                    Debug.WriteLine(ex.Message);
                    throw;
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(string.Format("Error reading process information for {0} : {1}", process.ToString(), ex.Message));
            }
            return null;
        }
All Usage Examples Of System.Diagnostics.Process::ToString