I have the following variable:
var setting =
$@"worker_processes {{0}};
worker_rlimit_nofile {{1}};
error_log logs/{{2}} {{3}};
events
{{
worker_connections {{4}};
multi_accept {{5}};
}}";
When I do the following String.Format()
operation on it:
return string.Format(setting,
this.worker_processes,
this.worker_rlimit_nofile,
this.error_log_file,
this.error_log_level,
this.worker_connections
this.multi_accept ? "on" : "off");
I get the following error: Input string was not in a correct format.
Any ideas?
EDIT - Fixed
Thanks to Jon Skeet, I have arrived at this solution without using String.Format()
:
return
$@"worker_processes { this.worker_processes };
worker_rlimit_nofile { this.worker_rlimit_nofile };
error_log logs/{ this.error_log_file } { this.error_log_level };
events
{{
worker_connections { this.worker_connections };
multi_accept { (this.multi_accept ? "on" : "off") };
}}";