From: Tony Johansson on

Assume that method CreateProgramFolder below exist in a assembly dll that we
call MyLib
You have also an assembly exe that is called MyExe that is calling this
MyLib's static CreateProgramFolder method
I know that when you use this kind of CAS method declaration it's the caller
that must fulfill the specified permissions.
In general all callers must have this permission in my example assembly
MyExe must have the CAS IO permission.

My first question:
I do understand pretty good about CAS assembly declaration by I don't fully
understand CAS method declaration that's why I wonder in this example what
permission must the assembly library MyLib has ?
I mean it's in this assembly MyLib where the code for CreateProgramFolder is
located so this must for example still mean that assembly MyLib must for
example have File IO permission otherwise it's not possible to access files
and folders.

My second question I don't really understand this SecurityAction.Demand. the
doc says the following "Instructs the runtime to throw an exception if the
caller and all callers higher in the stack lack the specified permission.?

[FileIOpermission(SecurityAction.Demand, Write = @"C:\Program Files\")]
public static void CreateProgramFolder()
//Method logic

You can give a comment if anything is not correct about what I have written