Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / clr / src / ManagedLibraries / Security / System / Security / permissions / dataprotectionpermissionattribute.cs / 1305376 / dataprotectionpermissionattribute.cs
// ==++==
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// ==--==
// [....]
//
//
// DataProtectionPermission.cs
//
namespace System.Security.Permissions {
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Constructor | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Assembly, AllowMultiple = true, Inherited = false )]
[Serializable()]
[System.Security.Permissions.HostProtection(MayLeakOnAbort = true)]
public sealed class DataProtectionPermissionAttribute : CodeAccessSecurityAttribute {
private DataProtectionPermissionFlags m_flags = DataProtectionPermissionFlags.NoFlags;
public DataProtectionPermissionAttribute (SecurityAction action) : base (action) {}
public DataProtectionPermissionFlags Flags {
get { return m_flags; }
set {
DataProtectionPermission.VerifyFlags(value);
m_flags = value;
}
}
public bool ProtectData {
get { return (m_flags & DataProtectionPermissionFlags.ProtectData) != 0; }
set { m_flags = value ? m_flags | DataProtectionPermissionFlags.ProtectData : m_flags & ~DataProtectionPermissionFlags.ProtectData; }
}
public bool UnprotectData {
get { return (m_flags & DataProtectionPermissionFlags.UnprotectData) != 0; }
set { m_flags = value ? m_flags | DataProtectionPermissionFlags.UnprotectData : m_flags & ~DataProtectionPermissionFlags.UnprotectData; }
}
public bool ProtectMemory {
get { return (m_flags & DataProtectionPermissionFlags.ProtectMemory) != 0; }
set { m_flags = value ? m_flags | DataProtectionPermissionFlags.ProtectMemory : m_flags & ~DataProtectionPermissionFlags.ProtectMemory; }
}
public bool UnprotectMemory {
get { return (m_flags & DataProtectionPermissionFlags.UnprotectMemory) != 0; }
set { m_flags = value ? m_flags | DataProtectionPermissionFlags.UnprotectMemory : m_flags & ~DataProtectionPermissionFlags.UnprotectMemory; }
}
public override IPermission CreatePermission () {
if (Unrestricted)
return new DataProtectionPermission(PermissionState.Unrestricted);
else
return new DataProtectionPermission(m_flags);
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// ==++==
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// ==--==
// [....]
//
//
// DataProtectionPermission.cs
//
namespace System.Security.Permissions {
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Constructor | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Assembly, AllowMultiple = true, Inherited = false )]
[Serializable()]
[System.Security.Permissions.HostProtection(MayLeakOnAbort = true)]
public sealed class DataProtectionPermissionAttribute : CodeAccessSecurityAttribute {
private DataProtectionPermissionFlags m_flags = DataProtectionPermissionFlags.NoFlags;
public DataProtectionPermissionAttribute (SecurityAction action) : base (action) {}
public DataProtectionPermissionFlags Flags {
get { return m_flags; }
set {
DataProtectionPermission.VerifyFlags(value);
m_flags = value;
}
}
public bool ProtectData {
get { return (m_flags & DataProtectionPermissionFlags.ProtectData) != 0; }
set { m_flags = value ? m_flags | DataProtectionPermissionFlags.ProtectData : m_flags & ~DataProtectionPermissionFlags.ProtectData; }
}
public bool UnprotectData {
get { return (m_flags & DataProtectionPermissionFlags.UnprotectData) != 0; }
set { m_flags = value ? m_flags | DataProtectionPermissionFlags.UnprotectData : m_flags & ~DataProtectionPermissionFlags.UnprotectData; }
}
public bool ProtectMemory {
get { return (m_flags & DataProtectionPermissionFlags.ProtectMemory) != 0; }
set { m_flags = value ? m_flags | DataProtectionPermissionFlags.ProtectMemory : m_flags & ~DataProtectionPermissionFlags.ProtectMemory; }
}
public bool UnprotectMemory {
get { return (m_flags & DataProtectionPermissionFlags.UnprotectMemory) != 0; }
set { m_flags = value ? m_flags | DataProtectionPermissionFlags.UnprotectMemory : m_flags & ~DataProtectionPermissionFlags.UnprotectMemory; }
}
public override IPermission CreatePermission () {
if (Unrestricted)
return new DataProtectionPermission(PermissionState.Unrestricted);
else
return new DataProtectionPermission(m_flags);
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- PageSettings.cs
- PartialClassGenerationTask.cs
- CodeDomLoader.cs
- AddInController.cs
- ClientSideProviderDescription.cs
- SerializeAbsoluteContext.cs
- FillBehavior.cs
- DataGridRow.cs
- MgmtConfigurationRecord.cs
- VectorConverter.cs
- ToolboxItem.cs
- ReliableChannelFactory.cs
- FormViewRow.cs
- HighContrastHelper.cs
- Nodes.cs
- CounterSample.cs
- WebWorkflowRole.cs
- NamespaceCollection.cs
- ProcessHostMapPath.cs
- FormViewDeletedEventArgs.cs
- IsolatedStorageFile.cs
- CompilerCollection.cs
- HttpChannelBindingToken.cs
- CollectionConverter.cs
- DefaultObjectMappingItemCollection.cs
- Version.cs
- ExtendedPropertyDescriptor.cs
- LazyTextWriterCreator.cs
- ManagementOptions.cs
- UInt16Storage.cs
- CompModSwitches.cs
- SqlRetyper.cs
- NumericPagerField.cs
- GetPageNumberCompletedEventArgs.cs
- PassportIdentity.cs
- OleDbTransaction.cs
- DataBoundLiteralControl.cs
- PrintingPermission.cs
- EdmScalarPropertyAttribute.cs
- EntryIndex.cs
- NameTable.cs
- PerformanceCounter.cs
- SetIndexBinder.cs
- FileVersion.cs
- InputScopeConverter.cs
- EntityType.cs
- StringCollectionEditor.cs
- CryptoKeySecurity.cs
- DataSourceControl.cs
- TextParaClient.cs
- XmlObjectSerializerWriteContextComplexJson.cs
- HttpResponse.cs
- CachedPathData.cs
- SingleTagSectionHandler.cs
- URLString.cs
- DataGridAutoFormatDialog.cs
- MessageFormatterConverter.cs
- DataServiceCollectionOfT.cs
- RelatedImageListAttribute.cs
- DescendantBaseQuery.cs
- SqlDataSourceSelectingEventArgs.cs
- NameValueCollection.cs
- ResolvedKeyFrameEntry.cs
- CalendarButton.cs
- AssemblyFilter.cs
- AssemblyNameProxy.cs
- DbParameterCollectionHelper.cs
- LocalizableResourceBuilder.cs
- StatusBar.cs
- TemplateBamlRecordReader.cs
- XmlNamespaceMappingCollection.cs
- SchemaElementDecl.cs
- _AutoWebProxyScriptWrapper.cs
- DebuggerAttributes.cs
- NavigatorOutput.cs
- PopupRoot.cs
- Int32Collection.cs
- WindowHelperService.cs
- ImageListImageEditor.cs
- SqlRowUpdatedEvent.cs
- ListViewItemEventArgs.cs
- TextElementEnumerator.cs
- StyleSheetComponentEditor.cs
- SqlSupersetValidator.cs
- ImageSourceConverter.cs
- FixedBufferAttribute.cs
- RC2.cs
- DeploymentExceptionMapper.cs
- Range.cs
- X509KeyIdentifierClauseType.cs
- GlyphRunDrawing.cs
- ScriptResourceHandler.cs
- EdmPropertyAttribute.cs
- AuthenticationModuleElement.cs
- CacheSection.cs
- DataListGeneralPage.cs
- Serializer.cs
- StrongTypingException.cs
- ResourcesGenerator.cs
- DoubleKeyFrameCollection.cs