Reputation: 382
tw.WriteLine(@" ""Air Temperature sensor "" 20," + measure + ", 24, """ + this.time.Year + "-" + this.time.Month + "-" + this.time.Day + " " + this.time.Hour + ":" + this.time.Minute + ":" + this.time.Second + "\"");
When I have three double quotes is call me I have Syntax error, ',' expected I try with four double quotes, with slash but again I have this error. I know for escaping double quotes is need two double quotes. But for my case is not working.
Upvotes: 1
Views: 899
Reputation: 3154
For what you are trying to achieve, the best approach is using string.Format
, as follows:
string.Format(@"""Air Temperature sensor "" 20, {0}, 24 "" {1:yyyy-MM-dd hh:mm:ss}", measure, this.time);
You don't need to build the date taking the single properties when .NET can format it for you.
Upvotes: 2
Reputation: 26362
As per msdn, you will either use @"" or escape with \"
https://msdn.microsoft.com/en-us/library/aa691090(v=vs.71).aspx
Upvotes: 1