가능한 중복 : C#을 위해 및 String.format를 사용할 때 가장 좋은 방법은 무엇
When is it better to use String.Format vs string concatenation?및 String.format
. 그냥이
private string _ExecuteCommand(string cmd)
{
// Start the child process.
Process p = new Process();
ProcessStartInfo startInfo = new ProcessStartInfo();
// Redirect the output stream of the child process.
startInfo.WindowStyle = ProcessWindowStyle.Hidden;
startInfo.FileName = "cmd.exe";
startInfo.Arguments = String.Format("/C {0}", cmd); // prevents the command line from staying open after execution
//... you get the idea
}
등의 작업을 수행하는 방법은 간단 것 때문에 난 항상 특별한 장점은 단지 문자열 연결 대 및 String.format를 사용하여 이상이 여기에 혼란스러워? 즉, 난 그냥
startInfo.Arguments = "/C " + cmd; // prevents the command line from staying open after execution
나는 품질의 코드를 persue 계속하고 싶습니다 ... 대신이 작업을 수행 할 수 있지만 quality
가 및 String.format를 사용하는 경우 모르겠어. 누구든지 어떤 제안이라도 있으면 고맙겠습니다.
안녕하세요, 도움이 될 것입니다. http://stackoverflow.com/questions/296978/when-is-it-better-to-use-string-format-vs-string-concatenation 환호! –
미안 해요! 나는 이것을 이렇게 찾았고 나는 그것을 놓쳐 버려야 만합니다. – Michael