Reading Text Blob line by line

Posted on 2011-10-31
Last Modified: 2012-05-12
How do i read a text blob , line by line like i am reading it from a text file ?

while ((line = file.ReadLine()) != "end")
                      // do stuff
Question by:byte1
    LVL 16

    Expert Comment

    by:Easwaran Paramasivam

    int counter = 0;
    string line;
    // Read the file and display it line by line.
    System.IO.StreamReader file =  new System.IO.StreamReader(@"c:\test.txt");
    while((line = file.ReadLine()) != null)
       Console.WriteLine (line);
    // Suspend the screen.

    Open in new window

    LVL 8

    Accepted Solution

    If you know for sure your BLOB is textual data, you just need to cast it to string and wrap into System.IO.StringReader. StringReader and StreamReader have the same base abstract class TextReader, so you can easily work with the same methods.
    LVL 8

    Expert Comment

    In the same manner binary BLOB data can be wrapped into MemoryStream. Then you can read it as any other stream.

    Author Closing Comment

    Thanks, that really worked.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
    It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    6 Experts available now in Live!

    Get 1:1 Help Now