Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / untmp / whidbey / QFE / ndp / clr / src / BCL / System / Security / Policy / GACMembershipCondition.cs / 2 / GACMembershipCondition.cs
// ==++==
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// ==--==
//
// GacMembershipCondition.cs
//
// Implementation of membership condition for being in the Gac
//
namespace System.Security.Policy {
using System;
using System.Collections;
using System.Globalization;
[Serializable]
[System.Runtime.InteropServices.ComVisible(true)]
sealed public class GacMembershipCondition : IMembershipCondition, IConstantMembershipCondition, IReportMatchMembershipCondition
{
//------------------------------------------------------
//
// PUBLIC CONSTRUCTORS
//
//-----------------------------------------------------
public GacMembershipCondition()
{
}
//-----------------------------------------------------
//
// IMEMBERSHIPCONDITION IMPLEMENTATION
//
//-----------------------------------------------------
public bool Check( Evidence evidence )
{
object usedEvidence = null;
return (this as IReportMatchMembershipCondition).Check(evidence, out usedEvidence);
}
bool IReportMatchMembershipCondition.Check(Evidence evidence, out object usedEvidence)
{
usedEvidence = null;
if (evidence == null)
return false;
IEnumerator enumerator = evidence.GetHostEnumerator();
while (enumerator.MoveNext())
{
Object obj = enumerator.Current;
if (obj is GacInstalled)
{
usedEvidence = obj;
return true;
}
}
return false;
}
public IMembershipCondition Copy()
{
return new GacMembershipCondition();
}
public SecurityElement ToXml()
{
return ToXml( null );
}
public void FromXml( SecurityElement e )
{
FromXml( e, null );
}
public SecurityElement ToXml( PolicyLevel level )
{
SecurityElement root = new SecurityElement( "IMembershipCondition" );
System.Security.Util.XMLUtil.AddClassAttribute( root, this.GetType(), this.GetType().FullName );
root.AddAttribute( "version", "1" );
return root;
}
public void FromXml( SecurityElement e, PolicyLevel level )
{
if (e == null)
throw new ArgumentNullException("e");
if (!e.Tag.Equals( "IMembershipCondition" ))
throw new ArgumentException( Environment.GetResourceString( "Argument_MembershipConditionElement" ) );
}
public override bool Equals( Object o )
{
GacMembershipCondition that = (o as GacMembershipCondition);
if (that != null)
return true;
return false;
}
public override int GetHashCode()
{
return 0;
}
public override String ToString()
{
return Environment.GetResourceString( "GAC_ToString" );
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- WindowManager.cs
- EntityViewGenerationConstants.cs
- WasHostedComPlusFactory.cs
- WebPermission.cs
- ObjectStateEntryDbDataRecord.cs
- SafeBitVector32.cs
- PersonalizationProvider.cs
- Converter.cs
- XappLauncher.cs
- IdentitySection.cs
- BamlMapTable.cs
- ToolStripComboBox.cs
- LambdaValue.cs
- BinaryObjectReader.cs
- DragStartedEventArgs.cs
- Base64Encoding.cs
- QuaternionAnimation.cs
- ImplicitInputBrush.cs
- XmlNamespaceManager.cs
- BaseValidator.cs
- NameScope.cs
- DataDocumentXPathNavigator.cs
- MessageEnumerator.cs
- TrustManager.cs
- DSGeneratorProblem.cs
- InputScopeConverter.cs
- VolatileResourceManager.cs
- SharedUtils.cs
- VolatileEnlistmentState.cs
- DependencyObjectType.cs
- TextDocumentView.cs
- Pair.cs
- RequestCachingSection.cs
- WebServiceErrorEvent.cs
- CommentAction.cs
- ApplicationHost.cs
- MdiWindowListItemConverter.cs
- DataGridCell.cs
- Soap.cs
- TrackBarRenderer.cs
- WebPartTransformerCollection.cs
- StorageEndPropertyMapping.cs
- ParallelTimeline.cs
- SiteMap.cs
- TextModifier.cs
- UnSafeCharBuffer.cs
- GenerateScriptTypeAttribute.cs
- baseshape.cs
- BulletedListEventArgs.cs
- SafeCryptHandles.cs
- AdPostCacheSubstitution.cs
- Tokenizer.cs
- RightsDocument.cs
- ThicknessAnimation.cs
- SymbolUsageManager.cs
- ContentPropertyAttribute.cs
- Action.cs
- TimeSpanSecondsOrInfiniteConverter.cs
- StringReader.cs
- XPathCompileException.cs
- ActivityContext.cs
- PeerObject.cs
- ServiceElement.cs
- CaseExpr.cs
- StylusShape.cs
- FixedSOMFixedBlock.cs
- DataGridHeaderBorder.cs
- BaseTransportHeaders.cs
- OperationFormatUse.cs
- WindowsScrollBarBits.cs
- EntityDataSourceEntitySetNameItem.cs
- ControlsConfig.cs
- CompositionCommandSet.cs
- OrderedDictionaryStateHelper.cs
- XmlSignatureProperties.cs
- RemoteWebConfigurationHostServer.cs
- SizeLimitedCache.cs
- HttpRuntimeSection.cs
- SmiEventSink_Default.cs
- ObjectDataSourceEventArgs.cs
- ConfigurationPropertyAttribute.cs
- DataListItemCollection.cs
- RTLAwareMessageBox.cs
- OrderPreservingSpoolingTask.cs
- ProtocolsConfigurationHandler.cs
- ResourceDisplayNameAttribute.cs
- TabControlEvent.cs
- Convert.cs
- DeclaredTypeValidatorAttribute.cs
- MetadataHelper.cs
- CloseCryptoHandleRequest.cs
- MexHttpsBindingElement.cs
- PopupEventArgs.cs
- OptimisticConcurrencyException.cs
- Queue.cs
- SeekableReadStream.cs
- LayoutInformation.cs
- DataGridItemEventArgs.cs
- CodeStatementCollection.cs
- IisTraceWebEventProvider.cs