|
Este artigo foi traduzido por máquina. Coloque o ponteiro do mouse sobre as frases do artigo para ver o texto original. Mais informações.
|
Tradução
Original
|
Enumeração SecurityAction
Assembly: mscorlib (em mscorlib.dll)
| Nome do membro | Descrição | |
|---|---|---|
| Demand | ||
| Assert | ||
| Deny | ||
| PermitOnly | ||
![]() ![]() | LinkDemand | |
| InheritanceDemand | ||
| RequestMinimum | ||
| RequestOptional | ||
| RequestRefuse |
LinkDemand | ||
InheritanceDemand | ||
Demand | ||
Assert | ||
Deny | ||
PermitOnly | ||
RequestMinimum | ||
RequestOptional | ||
RequestRefuse |
| Topic | Location |
|---|---|
| Como: Solicitar permissões opcionais usando o sinalizador RequestOptional | dv_fxsecurity |
| Como: Recusar permissões usando o sinalizador RequestRefuse | dv_fxsecurity |
| Como: Solicitar Permissões Mínimas Usando o Sinalizador RequestMinimum | dv_fxsecurity |
| Como: Solicitar permissões opcionais usando o sinalizador RequestOptional | .NET Framework: Security |
| Como: Recusar permissões usando o sinalizador RequestRefuse | .NET Framework: Security |
| Como: Solicitar Permissões Mínimas Usando o Sinalizador RequestMinimum | .NET Framework: Security |
using System; using System.Security.Permissions; using System.IO.IsolatedStorage; using System.IO; // Notify the CLR to grant this assembly the IsolatedStorageFilePermission. // This allows the assembly to work with storage files that are isolated // by user and assembly. [assembly: IsolatedStorageFilePermission(SecurityAction.RequestMinimum, UsageAllowed = IsolatedStorageContainment.AssemblyIsolationByUser)] publicsealedclass App { staticvoid Main() { // Attempt to create a storage file that is isolated by user and assembly.// IsolatedStorageFilePermission granted to the attribute at the top of this file // allows CLR to load this assembly and execution of this statement.using (Stream s = new IsolatedStorageFileStream("AssemblyData", FileMode.Create, IsolatedStorageFile.GetUserStoreForAssembly())) { // Write some data out to the isolated file.using (StreamWriter sw = new StreamWriter(s)) { sw.Write("This is some test data."); } } // Attempt to open the file that was previously created.using (Stream s = new IsolatedStorageFileStream("AssemblyData", FileMode.Open, IsolatedStorageFile.GetUserStoreForAssembly())) { // Read the data from the file and display it.using (StreamReader sr = new StreamReader(s)) { Console.WriteLine(sr.ReadLine()); } } } } // This code produces the following output.//// Some test data.
Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98, Windows CE, Windows Mobile for Smartphone, Windows Mobile for Pocket PC, Xbox 360
o.NET Framework e.NET Compact Framework não oferecem suporte a todas as versões de cada plataforma. Para obter uma lista de versões suportadas, consulte Requisitos de sistema do .NET framework.