by
11k 24
0
5
87k
1
Top 1% !
Pearl of Wisdom
Tagged
Specified
OpenSource
Popularity: 27766th place
Created
Modified Apr 27, 2015
xml
Architecturex86_64
LanguageCSharp
LicenseMIT_X11
OSWindows
Windows VersionWindows7

CreateXmlCloseTag

Creates the XML close tag string for an XElement.
Copy Embed Code
<iframe id="embedFrame" style="width:600px; height:300px;"
src="https://www.snip2code.com/Embed/440440/CreateXmlCloseTag?startLine=0"></iframe>
Click on the embed code to copy it into your clipboard Width Height
Leave empty to retrieve all the content Start End
using EnvDTE; using SteveCadwallader.CodeMaid.Model.Comments; using System.Diagnostics; using System.Text.RegularExpressions; /// <summary> /// Creates the XML close tag string for an XElement. /// </summary> /// <param name="element">The element.</param> /// <param name="options">The comment options used to contruct the tag.</param> /// <returns> /// The XML close tag, or <c>null</c> if the element has no value and is a self-closing tag. /// </returns> internal static string CreateXmlCloseTag(System.Xml.Linq.XElement element, CodeCommentOptions options) { if (element.IsEmpty) { return null; } var name = element.Name.LocalName; var result = string.Format("</{0}>", options.XmlTagsToLowerCase ? name.ToLowerInvariant() : name); return options.XmlKeepTagsTogether ? SpaceToFake(result) : result; }
If you want to be updated about similar snippets, Sign in and follow our Channels

blog comments powered by Disqus