Delimiter Replacement Approach
<p>I’d like to create a method to replace delimiters for the intended target use (html email, log, database). The delimiters are constant so I’d like to be able to reference a object that maps recognizable names to string values (semicolon = “;”, htmlLineBreak = “&lt;br/>”, etc.). Is there a better means to do this than this below?</p>

<pre><code>public static class Utilities
{
    public string ReplaceDelimiter(string content
                     , Delimiter currentDelimiter, Delimiter outputDelimiter)
    {
        return content.Replace(currentDelimiter.ToString()
                              , outputDelimiter.ToString());
    }
}

public class Delimiter
{
    public const string comma = ",";
    public const string semicolon = ";";
    public const string colon = ":";
    public const string lineBreak = "\r\n";
    public const string htmlLineBreak = "&lt;br/&gt;";
}
</code></pre>

<p><b>Edited following comments:</b><br>
A use case would be when I want to log an error to different targets and send the same contents (formatted differently) in an email. The log may go to a database column (want key/value with semicolon delimiter) or log file (want delimiter to be line breaks). The email would be HTML so want the delimiter to be replaced with &lt;br/>. </p>

<p>Below would be an excerpt from a logging method that has a few parameters including the actual Exception:</p>

<pre><code>StringBuilder delimitedMessage = new StringBuilder();

delimitedMessage.Append("Date=" + DateTime.Now.ToShortDateString() + ";");
delimitedMessage.Append("Time=" + DateTime.Now.ToLongTimeString() + ";");
delimitedMessage.Append("Source=" + objException.Source.ToString().Trim() + ";");
delimitedMessage.Append("Method=" + objException.TargetSite.Name.ToString() + ";");
delimitedMessage.Append("Erring Method=" + methodName + ";");
delimitedMessage.Append("Computer=" + System.Environment.MachineName.ToString() + ";");
delimitedMessage.Append("Log Message=" + logMessage + ";");
delimitedMessage.Append("Exception Error=" + objException.Message.ToString().Trim() + ";");
delimitedMessage.Append("Severity=" + severity.ToString() + ";");
delimitedMessage.Append("Stack Trace=" + objException.StackTrace.ToString().Trim() + ";");

contentToLog = delimitedMessage.ToString();

WriteToDb(contentToLog);
WriteToLog(Utilities.ReplaceDelimiter(contentToLog, Delimiter.semicolon, Delimiter.lineBreak));
SendEmail(Utilities.ReplaceDelimiter(contentToLog, Delimiter.semicolon, Delimiter.htmlLineBreak));
</code></pre>
