I'm writing a C# application that needs to generate an HTML page. Only parts of the HTML (such as the title) need to be defined by the C# app. Basic markup etc is static.
Giving the example of title, currently I'm doing it this way. I have the basic html saved as a txt file. here's a portion:
<head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252" /> <title>Title goes here</title> <link rel="stylesheet" type="text/css" href="style.css" /> </head> I read this into a string (wireframe) in my C# app, and then to change the title, I do a
oldtitle = "<title>Title goes here</title>"; newtitle = "<title>This is the title I want</title>"; wireframe = wireframe.Replace(oldtite,newtitle); The above is just an example. the string wireframe actually consists of the entire html code. I'm wondering if the way I'm doing it is efficient? I'm guessing not since to change the title, I'm searching through the entire string.
What would be a more efficient way to achieve this?