本文整理匯總了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);
}
}