Class SvgComment
An XML comment, kept so a save writes it back.
public sealed class SvgComment : SvgContent
- Inheritance
-
SvgComment
- Inherited Members
Examples
SvgDocument document = SvgDocument.Parse(Icon);
// Elements, attributes and text are an editable tree, like XDocument's.
SvgElement body = document.FindById("body")!;
body.Attributes["fill"] = "#c33";
body.Attributes.Set("href", "#other", SvgNamespaces.XLink, "xlink");
SvgElement dot = new("circle");
dot.Attributes["cx"] = "12";
dot.Attributes["cy"] = "12";
dot.Attributes["r"] = "3";
document.Root.Children.Add(dot);
document.Root.Children.Add(new SvgComment(" added in code "));
foreach (SvgElement element in document.Root.Elements())
{
Console.WriteLine($"{element.Name}: {element.Attributes.Count} attributes");
}
Constructors
SvgComment(string)
Initializes a new instance of the SvgComment class.
public SvgComment(string value)
Parameters
valuestringThe comment's text, without the
<!--and-->markers.
Properties
Value
Gets the comment's text.
public string Value { get; }
Property Value
Methods
Clone()
Makes a deep copy without a parent: an element is copied with its attributes and all its content.
public override SvgContent Clone()
Returns
- SvgContent
The copy.
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.