title image


Smiley !MICROSOFT!
Das Beispiel ist aus der Microsoft Hilfe, ich besitze keine Urheberschaft!!!

using System;

using System.Security;

using System.Security.Permissions;

using System.Collections;



[assembly:CLSCompliant(true)]



public class FileIOPermissionDemo

{

// IsSubsetOf determines whether the current permission is a subset of the specified permission.

// This method compares various FileIOPermission paths with FileIOPermissionAccess set to AllAccess.

private bool IsSubsetOfDemo()

{



bool returnValue = true;



string fileIO1,fileIO2;

FileIOPermission fileIOPerm1,fileIOPerm2;



FileIOGenerator fileIOGen1 = new FileIOGenerator();

FileIOGenerator fileIOGen2 = new FileIOGenerator();



fileIOGen1.ResetIndex();

while(fileIOGen1.CreateFilePath(out fileIOPerm1, out fileIO1, FileIOPermissionAccess.AllAccess))

{

if(fileIOPerm1 == null) continue;



Console.WriteLine("**********************************************************\n");



fileIOGen2.ResetIndex();



while(fileIOGen2.CreateFilePath(out fileIOPerm2, out fileIO2, FileIOPermissionAccess.AllAccess))

{

string firstPermission = fileIO1 == "" | fileIO1 == null ? "null" : fileIO1 ;

string secondPermission = fileIO2 == "" | fileIO2 == null ? "null" : fileIO2;

if(fileIOPerm2 == null) continue;

try

{

if (fileIOPerm1.IsSubsetOf(fileIOPerm2))

{



Console.WriteLine(firstPermission +" is a subset of " + secondPermission + "\n");

}

else

{

Console.WriteLine(firstPermission +" is not a subset of " + secondPermission + "\n");

}



}

catch(Exception e)

{

Console.WriteLine("An exception was thrown for subset :" + fileIO1 == "" ? "null" : fileIO1 + "\n" +

fileIO2 == "" ? "null" : fileIO2 +"\n" + e);

}

}

}

return returnValue;

}



geschrieben von

Login

E-Mail:
  

Passwort:
  

Beitrag anfügen

Symbol:
 
 
 
 
 
 
 
 
 
 
 
 
 

Überschrift: