Skip to content

Instantly share code, notes, and snippets.

@urasandesu
Created January 18, 2014 12:57
Show Gist options
  • Save urasandesu/8490106 to your computer and use it in GitHub Desktop.
Save urasandesu/8490106 to your computer and use it in GitHub Desktop.
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