Search code examples
c#asp.netlistviewtwitterlinq-to-twitter

Display an entire list in ListView (including all properties) without Layout & Item Template


I am playing around with a new Twitter NuGet package (LinqToTwitter), which uses a linq query to return data. I haven't been able to find any documentation that shows all possible return types from a statement such as the following: (I got this from some sample code)

    var users =
        from tweet in twitterCtx.User
        where tweet.Type == UserType.Show &&
              tweet.ScreenName == txtScreenName.Text
        select tweet;

This query returns a user's latest status update.

I want to know everything that I can possibly get from 'var users' as well as how I can manipulate that data. The easiest way would obviously be to check the results view after this is populated in debug, but I keep getting a timeout error that prevents me from seeing inside the object.

MY QUESTION: Is there a way to print out everything that 'var users' returns? I assumed this would be simple in a ListView, but since you have to define a layout, it's not a good option unless there is a way to do without. I'm open to anything that will let me see everything that is returned. Some kind of export function?


Solution

  • Try to use some reflection like:

    var t = tweet.GetType();
    foreach (var p in t.GetProperties())
    {
        Console.WriteLine(p.Name);
    }
    foreach (var f in t.GetFields())
    {
        Console.WriteLine(f.Name);
    }
    

    Try other fields of PropertyInfo and FieldInfo objects.