Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / clr / src / BCL / System / Security / Permissions / GACIdentityPermission.cs / 1305376 / GACIdentityPermission.cs
// ==++==
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// ==--==
// GacIdentityPermission.cs
//
// [....]
//
namespace System.Security.Permissions
{
using System;
#if FEATURE_CAS_POLICY
using SecurityElement = System.Security.SecurityElement;
#endif // FEATURE_CAS_POLICY
using System.Globalization;
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Constructor | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Assembly, AllowMultiple = true, Inherited = false )]
[System.Runtime.InteropServices.ComVisible(true)]
[Serializable]
sealed public class GacIdentityPermissionAttribute : CodeAccessSecurityAttribute
{
public GacIdentityPermissionAttribute( SecurityAction action )
: base( action )
{
}
public override IPermission CreatePermission()
{
return new GacIdentityPermission();
}
}
[System.Runtime.InteropServices.ComVisible(true)]
[Serializable]
sealed public class GacIdentityPermission : CodeAccessPermission, IBuiltInPermission
{
//------------------------------------------------------
//
// PUBLIC CONSTRUCTORS
//
//-----------------------------------------------------
public GacIdentityPermission(PermissionState state)
{
if (state != PermissionState.Unrestricted && state != PermissionState.None)
{
throw new ArgumentException(Environment.GetResourceString("Argument_InvalidPermissionState"));
}
}
public GacIdentityPermission()
{
}
//-----------------------------------------------------
//
// IPERMISSION IMPLEMENTATION
//
//-----------------------------------------------------
public override IPermission Copy()
{
return new GacIdentityPermission();
}
public override bool IsSubsetOf(IPermission target)
{
if (target == null)
return false;
if (!(target is GacIdentityPermission))
throw new ArgumentException(Environment.GetResourceString("Argument_WrongType", this.GetType().FullName));
return true;
}
public override IPermission Intersect(IPermission target)
{
if (target == null)
return null;
if (!(target is GacIdentityPermission))
throw new ArgumentException(Environment.GetResourceString("Argument_WrongType", this.GetType().FullName));
return this.Copy();
}
public override IPermission Union(IPermission target)
{
if (target == null)
return this.Copy();
if (!(target is GacIdentityPermission))
throw new ArgumentException(Environment.GetResourceString("Argument_WrongType", this.GetType().FullName));
return this.Copy();
}
#if FEATURE_CAS_POLICY
public override SecurityElement ToXml()
{
SecurityElement securityElement = CodeAccessPermission.CreatePermissionElement( this, "System.Security.Permissions.GacIdentityPermission" );
return securityElement;
}
public override void FromXml(SecurityElement securityElement)
{
CodeAccessPermission.ValidateElement(securityElement, this);
}
#endif // FEATURE_CAS_POLICY
///
int IBuiltInPermission.GetTokenIndex()
{
return GacIdentityPermission.GetTokenIndex();
}
internal static int GetTokenIndex()
{
return BuiltInPermissionIndex.GacIdentityPermissionIndex;
}
}
}
// 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
- DocumentReferenceCollection.cs
- DelegateSerializationHolder.cs
- AjaxFrameworkAssemblyAttribute.cs
- OleDbParameterCollection.cs
- TableLayoutRowStyleCollection.cs
- ImageClickEventArgs.cs
- PropertyPath.cs
- TcpProcessProtocolHandler.cs
- CompModSwitches.cs
- DataKeyArray.cs
- WriteFileContext.cs
- TreeView.cs
- NamespaceCollection.cs
- TreeViewImageKeyConverter.cs
- NavigationProperty.cs
- RTTypeWrapper.cs
- ToolboxItemCollection.cs
- UrlAuthFailedErrorFormatter.cs
- Setter.cs
- ResourceProviderFactory.cs
- ConditionalAttribute.cs
- WebControlAdapter.cs
- FactoryMaker.cs
- ObjectPropertyMapping.cs
- ClockGroup.cs
- GZipStream.cs
- EventEntry.cs
- BuildProvider.cs
- DelegateSerializationHolder.cs
- MachineKeySection.cs
- PlaceHolder.cs
- Types.cs
- EdmScalarPropertyAttribute.cs
- SelectionRangeConverter.cs
- ToolTipService.cs
- Delegate.cs
- XmlNamespaceManager.cs
- Stack.cs
- ShaderEffect.cs
- WindowPattern.cs
- OracleDataReader.cs
- StringResourceManager.cs
- StylusDownEventArgs.cs
- ThaiBuddhistCalendar.cs
- ToolStrip.cs
- IODescriptionAttribute.cs
- XmlDownloadManager.cs
- TabControl.cs
- EUCJPEncoding.cs
- ListView.cs
- InternalPermissions.cs
- TextTreeTextBlock.cs
- AxisAngleRotation3D.cs
- HijriCalendar.cs
- ToolStripItemClickedEventArgs.cs
- PageParserFilter.cs
- StagingAreaInputItem.cs
- CorrelationTokenInvalidatedHandler.cs
- Label.cs
- UserThread.cs
- IResourceProvider.cs
- TypeInitializationException.cs
- SchemaMerger.cs
- TransformGroup.cs
- WebDisplayNameAttribute.cs
- LeaseManager.cs
- ProcessInputEventArgs.cs
- ForwardPositionQuery.cs
- DBAsyncResult.cs
- DataAdapter.cs
- ToolStripItemBehavior.cs
- TextSimpleMarkerProperties.cs
- MimeWriter.cs
- TableRowCollection.cs
- ElementNotEnabledException.cs
- SignerInfo.cs
- ArgumentFixer.cs
- HtmlElementCollection.cs
- DataGridColumnsPage.cs
- FontEmbeddingManager.cs
- TextPointer.cs
- AuthenticationSection.cs
- RankException.cs
- DropShadowBitmapEffect.cs
- EncoderNLS.cs
- XPathParser.cs
- CodeGenerator.cs
- ExecutionContext.cs
- XPathBinder.cs
- Timer.cs
- RadioButtonAutomationPeer.cs
- SmiXetterAccessMap.cs
- DataBoundLiteralControl.cs
- PinnedBufferMemoryStream.cs
- XmlSchemaInfo.cs
- SimpleTypeResolver.cs
- parserscommon.cs
- FilteredDataSetHelper.cs
- __FastResourceComparer.cs
- ProgressiveCrcCalculatingStream.cs