다음을 통해 공유


IPersistentSpan.TryGetSpan(Span) Method

Definition

Get the span as a character offset from the start of the buffer.

public:
 bool TryGetSpan([Runtime::InteropServices::Out] Microsoft::VisualStudio::Text::Span % span);
public:
 bool TryGetSpan([Runtime::InteropServices::Out] Microsoft::VisualStudio::Text::Span &  span);
bool TryGetSpan([Runtime::InteropServices::Out] Microsoft::VisualStudio::Text::Span & span);
public bool TryGetSpan (out Microsoft.VisualStudio.Text.Span span);
abstract member TryGetSpan : Span -> bool
Public Function TryGetSpan (ByRef span As Span) As Boolean

Parameters

span
Span

Corresponding span in the buffer.

Returns

true if the the out parameters are valid; false otherwise (in which case TryGetStartLineIndex/TryGetEndLineIndex will work).

Remarks

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(Int32, Int32) and TryGetEndLineIndex(Int32, Int32) before using this method.

Applies to