Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Implicitly casting a Tag to a string.
public static implicit operator string(Tag tag)
{
return tag.ToString();
}
public override string ToString()
{
var sb = new StringBuilder();
sb.Append("<").Append(_name);
foreach (var p in _props)
{
sb.Append(" ")
.Append(p.Key.ToLower())
.Append("=\"")
.Append(p.Value)
.Append("\"");
}
sb.Append(">")
.Append(_content)
.Append("</")
.Append(_name)
.Append(">");
return sb.ToString();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment