Using streamreader to read the entire stream at once : Stream « File Directory Stream « C# / CSharp Tutorial

C# / CSharp Tutorial
1. Language Basics
2. Data Type
3. Operator
4. Statement
5. String
6. struct
7. Class
8. Operator Overload
9. delegate
10. Attribute
11. Data Structure
12. Assembly
13. Date Time
14. Development
15. File Directory Stream
16. Preprocessing Directives
17. Regular Expression
18. Generic
19. Reflection
20. Thread
21. I18N Internationalization
22. GUI Windows Forms
23. 2D
24. Design Patterns
25. Windows
26. XML
27. ADO.Net
28. Network
29. Directory Services
30. Security
31. unsafe
Java
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
C# / C Sharp
ASP.Net
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
PHP
Python
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
C# / CSharp Tutorial » File Directory Stream » Stream 
15. 18. 7. Using streamreader to read the entire stream at once
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.IO;
using System.IO.Compression;
using System.Net;
using System.Net.Mail;
using System.Net.Sockets;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;

public class MainClass
{
    public static void Main()
    {
   
        Stream s = new FileStream("c:\\test.txt", FileMode.Open);
        using (StreamReader sr = new StreamReader(s, Encoding.UTF8))
        {
            Console.WriteLine(sr.ReadToEnd());
        }
    }
}
15. 18. Stream
15. 18. 1. C#'s I/O Is Built Upon Streams
15. 18. 2. The Stream Classes
15. 18. 3. The Byte Stream Classes and The Character Stream Wrapper Classes
15. 18. 4. Stream seeking: SeekOrigin.Current, SeekOrigin.Begin, SeekOrigin.End
15. 18. 5. Using streamreader to decode streams
15. 18. 6. Using streamreader to read entire lines at a time
15. 18. 7. Using streamreader to read the entire stream at once
15. 18. 8. Reading from a stream, casting to chars
15. 18. 9. Reading from a stream buffer at a time
ww___w___.___j_a__va2__s.___c__o___m_ | Contact Us
Copyright 2003 - 08 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.