I'm writing a series of tests to validate code I'm writing. I want the documentation for the tests to list how the tests are finding errors. Instead of making sure the documentation gets updated with the tests I'd like to output the line of code. Is there a way to save it in a string?
The code would look like:
string Date = String.Format("Name = {0}, hours = {1:hh}", name, DateTime.Now); string Code = ""Name = {0}, hours = {1:hh}", name, DateTime.Now" Date would be evaluated, while Code would be the literal string. Something like:
string Date = string.Format(Code); https://stackoverflow.com/questions/65605046/how-can-i-save-lines-of-c-sharp-code-into-a-string January 07, 2021 at 08:19AM
没有评论:
发表评论