本文整理汇总了C#中System.Xml.Linq.XNode.Remove方法的典型用法代码示例。如果您正苦于以下问题:C# XNode.Remove方法的具体用法?C# XNode.Remove怎么用?C# XNode.Remove使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.Linq.XNode
的用法示例。
在下文中一共展示了XNode.Remove方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Makeerror
/// <summary>
/// Makeerrors the specified r.
/// </summary>
/// <param name="r"> The r. </param>
/// <param name="t"> The t. </param>
/// <param name="ic"> The ic. </param>
/// <param name="desc"> The desc. </param>
/// <param name="error"> The error. </param>
/// <param name="code"> The code. </param>
/// <returns> </returns>
/// <remarks>
/// </remarks>
private bool Makeerror(XNode r, ThemaDescriptor t, string ic, XmlExtensions.XmlElementDescriptor desc, string error,
int code) {
r.Remove();
var message = string.Format("error in uselib resolution in {0}/{1} {2}:{3} - {4}", t.Code, ic, desc.File,
desc.Line,
error);
var ecprefix = "WRLIBR0";
var level = ErrorLevel.Warning;
if (Context.Project.NonResolvedLibraryIsError) {
ecprefix = "ERLIBR0";
level = ErrorLevel.Error;
}
var ecode = ecprefix + code;
AddError(level, message, ecode, null, desc.File, desc.Line);
if (ErrorLevel.Error == level) {
UserLog.Error(message);
}
else {
UserLog.Warn(message);
}
return ErrorLevel.Error == level;
}
示例2: RemoveIndented
internal static void RemoveIndented(XNode element)
{
// NOTE: this method is tested by BindinRedirectManagerTest and SettingsTest
var textBeforeOrNull = element.PreviousNode as XText;
var textAfterOrNull = element.NextNode as XText;
var oneIndentLevel = ComputeOneLevelOfIndentation(element);
var isLastChild = !element.ElementsAfterSelf().Any();
element.Remove();
if (textAfterOrNull != null
&& IsWhiteSpace(textAfterOrNull))
{
textAfterOrNull.Remove();
}
if (isLastChild
&& textBeforeOrNull != null
&& IsWhiteSpace(textAfterOrNull))
{
textBeforeOrNull.Value = textBeforeOrNull.Value.Substring(0, textBeforeOrNull.Value.Length - oneIndentLevel.Length);
}
}