0

I'm looking at this method in ISymbol:

string ToMinimalDisplayString(SemanticModel semanticModel, int position, SymbolDisplayFormat format = null);

The documentation says that position is "A position in the source code (context)." What is the unit of measure of position? Is it a line number? In other words, can I use this value:

mySyntaxTree.GetLocation(myNode.Span).GetLineSpan().StartLinePosition.Line;

Edit: Some non-definitive experimenting suggests that it is not a line number, because when I use the above value, the method does not remove unnecessary namespaces. But the following value seems to give the right behaviour:

myNode.Span.Start;

1 Answer 1

2

As you did figure out the "position" is the zero-based index of characters like our start/end span. The API never really accepts lines for the most part, since those are generally user-displayed only.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.