Referencing Namespaces in C# headers with using-directives

138 Views Asked by At

I want to have using codes like as shown below, for example:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
using System.IO;

but this c# code below (taken from the question Command prompt output being read as empty string) has no headers like above to compiled with csc.exe in cmd console and i tried to comment on that thread but a requirement of 50 reputation is needed and i had no VB studio IDE yet and im new to learning C#.

var output = new StringBuilder();
var error = new StringBuilder();

cmd.OutputDataReceived += (o, e) => output.Append(e.Data);
cmd.ErrorDataReceived += (o, e) => error.Append(e.Data);

cmd.Start();
cmd.BeginOutputReadLine();
cmd.BeginErrorReadLine();
cmd.WaitForExit();
1

There are 1 best solutions below

4
Adam On

Process belongs to System.Diagnostics, and StringBuilder belongs to System.Text.

If in doubt, google the method names and see what objects have them on MSDN, then look at their namespace.