本文整理汇总了C#中System.Web.Razor.Text.TextChange.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# TextChange.ToString方法的具体用法?C# TextChange.ToString怎么用?C# TextChange.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.Razor.Text.TextChange
的用法示例。
在下文中一共展示了TextChange.ToString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckForStructureChanges
/// <summary>
/// Determines if a change will cause a structural change to the document and if not, applies it to the existing tree.
/// If a structural change would occur, automatically starts a reparse
/// </summary>
/// <remarks>
/// NOTE: The initial incremental parsing check and actual incremental parsing (if possible) occurs
/// on the callers thread. However, if a full reparse is needed, this occurs on a background thread.
/// </remarks>
/// <param name="change">The change to apply to the parse tree</param>
/// <returns>A PartialParseResult value indicating the result of the incremental parse</returns>
public virtual PartialParseResult CheckForStructureChanges(TextChange change)
{
// Validate the change
long? elapsedMs = null;
#if EDITOR_TRACING
Stopwatch sw = new Stopwatch();
sw.Start();
#endif
RazorEditorTrace.TraceLine(RazorResources.Trace_EditorReceivedChange, Path.GetFileName(FileName), change);
if (change.NewBuffer == null)
{
throw new ArgumentException(String.Format(CultureInfo.CurrentUICulture,
RazorResources.Structure_Member_CannotBeNull,
"Buffer",
"TextChange"), "change");
}
PartialParseResult result = PartialParseResult.Rejected;
// If there isn't already a parse underway, try partial-parsing
string changeString = String.Empty;
using (_parser.SynchronizeMainThreadState())
{
// Capture the string value of the change while we're synchronized
changeString = change.ToString();
// Check if we can partial-parse
if (CurrentParseTree != null && _parser.IsIdle)
{
result = TryPartialParse(change);
}
}
// If partial parsing failed or there were outstanding parser tasks, start a full reparse
if (result.HasFlag(PartialParseResult.Rejected))
{
_parser.QueueChange(change);
}
// Otherwise, remember if this was provisionally accepted for next partial parse
LastResultProvisional = result.HasFlag(PartialParseResult.Provisional);
VerifyFlagsAreValid(result);
#if EDITOR_TRACING
sw.Stop();
elapsedMs = sw.ElapsedMilliseconds;
sw.Reset();
#endif
RazorEditorTrace.TraceLine(RazorResources.Trace_EditorProcessedChange, Path.GetFileName(FileName), changeString, elapsedMs.HasValue ? elapsedMs.Value.ToString() : "?", result.ToString());
return result;
}