//FileIOPermission Attribute has been used to prevent the reading of files from C Drive
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
//add these namespaces
using System.Security.Permissions;
using System.IO;
namespace ConsoleApplication20jan
{
class Class7
{
[FileIOPermission(SecurityAction.Deny,Read="C:\\")]
static void mymethod()
{
StreamReader dr = new StreamReader("c:\\windows\\abc.txt");
Console.WriteLine(dr.ReadToEnd());
dr.Close();
}
static void Main()
{
mymethod();
}
}
}