Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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. // // ==--== // // 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ValidationSummary.cs
- RegexCapture.cs
- MultiViewDesigner.cs
- GroupQuery.cs
- DbReferenceCollection.cs
- AdvancedBindingPropertyDescriptor.cs
- Int32Animation.cs
- DesignConnection.cs
- InlineUIContainer.cs
- PhysicalFontFamily.cs
- LocationUpdates.cs
- LinkUtilities.cs
- CommonXSendMessage.cs
- SafeProcessHandle.cs
- DocumentSchemaValidator.cs
- DBCommand.cs
- FragmentNavigationEventArgs.cs
- CachedRequestParams.cs
- FieldBuilder.cs
- Select.cs
- RemoteWebConfigurationHostStream.cs
- UpdateCompiler.cs
- RSAPKCS1SignatureDeformatter.cs
- EntityDataReader.cs
- TextFormatterContext.cs
- CheckPair.cs
- Byte.cs
- TextRangeEdit.cs
- ReadOnlyObservableCollection.cs
- EmbeddedMailObjectsCollection.cs
- CacheDependency.cs
- MimeTypePropertyAttribute.cs
- NativeRightsManagementAPIsStructures.cs
- SecureUICommand.cs
- MetadataArtifactLoader.cs
- ResourceProviderFactory.cs
- GiveFeedbackEvent.cs
- NavigationFailedEventArgs.cs
- DoubleCollectionValueSerializer.cs
- ProfileSettings.cs
- DataGridViewComboBoxEditingControl.cs
- TrustLevelCollection.cs
- StrokeDescriptor.cs
- KnownTypes.cs
- Walker.cs
- RegexWorker.cs
- EntityContainer.cs
- DocumentReferenceCollection.cs
- XmlValidatingReader.cs
- StorageScalarPropertyMapping.cs
- OpCodes.cs
- WeakEventManager.cs
- GridViewEditEventArgs.cs
- Point3DAnimation.cs
- ConnectionsZone.cs
- QuaternionAnimation.cs
- EndpointNotFoundException.cs
- MatrixTransform3D.cs
- OdbcHandle.cs
- DataColumnMapping.cs
- ScaleTransform.cs
- SdlChannelSink.cs
- QilStrConcatenator.cs
- ReservationNotFoundException.cs
- AnnotationMap.cs
- SymbolType.cs
- GeneralTransform3DCollection.cs
- ObjectItemConventionAssemblyLoader.cs
- Serializer.cs
- OdbcConnectionHandle.cs
- NumberSubstitution.cs
- BidPrivateBase.cs
- WsatConfiguration.cs
- ObjectDataSourceDesigner.cs
- httpserverutility.cs
- ConfigXmlText.cs
- Group.cs
- ModulesEntry.cs
- WebPartTransformer.cs
- DetailsViewCommandEventArgs.cs
- ResourceReferenceKeyNotFoundException.cs
- RowUpdatingEventArgs.cs
- IPPacketInformation.cs
- ProtocolsSection.cs
- SqlExpressionNullability.cs
- DataControlImageButton.cs
- Header.cs
- SystemIPGlobalProperties.cs
- DataSetViewSchema.cs
- infer.cs
- PeerContact.cs
- RSAPKCS1KeyExchangeDeformatter.cs
- DataGridViewRowContextMenuStripNeededEventArgs.cs
- StringUtil.cs
- FloaterBaseParaClient.cs
- DataGridViewButtonColumn.cs
- ToolStripKeyboardHandlingService.cs
- ConfigXmlCDataSection.cs
- TimeSpanMinutesOrInfiniteConverter.cs
- ErrorHandler.cs