Created
January 18, 2014 12:57
-
-
Save urasandesu/8490106 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.IO; | |
namespace mscorlib.Prig | |
{ | |
public class EHClass | |
{ | |
public void ReadFile(string path, int index) | |
{ | |
var file = default(StreamReader); | |
var buffer = new char[10]; | |
try | |
{ | |
file = new StreamReader(path); | |
file.ReadBlock(buffer, index, buffer.Length); | |
} | |
catch (IOException e) | |
{ | |
Console.WriteLine("Error reading from {0}. Message = {1}", path, e.Message); | |
} | |
finally | |
{ | |
if (file != null) | |
file.Close(); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment