TextLine Text property confusion

Topics: APIs
May 28, 2014 at 12:24 PM
If I have some code like this:
var tree = CSharpSyntaxTree.ParseText(
@"using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text; 

namespace HelloWorld 
{ 
    class Program 
    { 
        static void Main(string[] args) 
        { 
            Console.WriteLine(""Hello, World!""); 
        }
    }
}");

var lines = tree.GetText().Lines;           
And I want to iterate through the individual TestLine items, this seems like the most intuitive property to use
foreach (var line in lines)
{
    Console.WriteLine(line.Text);
}
However the Text property returns the entire source text, not the individual line, instead you need to do this:
foreach (var line in lines)
{
    Console.WriteLine(line.ToString());
}
Maybe it's just me, but it seems a bit unintuitive to have the Text property, but not have it give you the Text for the current line?