IPersistentSpan::TryGetSpan Method (Span)

Visual Studio 2015
 

Get the span as a character offset from the start of the buffer./// </summary>/// <param name="span"> </param>/// <returns> </returns>/// <remarks>/// <para> </para>/// </remarks>

Namespace:   Microsoft.VisualStudio.Text
Assembly:  Microsoft.VisualStudio.Text.Data (in Microsoft.VisualStudio.Text.Data.dll)

bool TryGetSpan(
	[OutAttribute] Span% span
)

Parameters

span
Type: Microsoft.VisualStudio.Text::Span

[out] The corresponding span in the buffer.

Return Value

Type: System::Boolean

True if the out parameters are valid; false otherwise (in which case either TryGetStartLineIndex or TryGetEndLineIndex will work).

This method can be used on any span if the underlying document is open. If the underlying document is closed, then this method only be used if the document was created using the span method of the factory and the document has never been opened after the span was created. In general, you should try to use TryGetStartLineIndex and TryGetEndLineIndex before using this method.

Return to top
Show: