Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / ndp / clr / src / BCL / System / Security / Policy / GACMembershipCondition.cs / 1 / 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
- EntitySet.cs
- AmbiguousMatchException.cs
- SHA384.cs
- VersionPair.cs
- RSAPKCS1SignatureFormatter.cs
- AutoGeneratedFieldProperties.cs
- DesignTimeParseData.cs
- StrokeNodeEnumerator.cs
- ProcessInfo.cs
- Accessible.cs
- AssemblyUtil.cs
- PropertyValueChangedEvent.cs
- PageAsyncTaskManager.cs
- ListViewItemEventArgs.cs
- PropertyGroupDescription.cs
- EventLogPermissionAttribute.cs
- ScriptMethodAttribute.cs
- PeerResolverElement.cs
- JsonEncodingStreamWrapper.cs
- DispatchChannelSink.cs
- AttachInfo.cs
- DataPagerFieldCommandEventArgs.cs
- UnauthorizedAccessException.cs
- UnsafeNativeMethods.cs
- FontNameEditor.cs
- FixedTextView.cs
- BooleanToVisibilityConverter.cs
- ProcessModuleCollection.cs
- lengthconverter.cs
- MemoryStream.cs
- ComplexBindingPropertiesAttribute.cs
- CrossAppDomainChannel.cs
- PersistenceTypeAttribute.cs
- Vector3dCollection.cs
- ParserContext.cs
- Keyboard.cs
- EventDescriptorCollection.cs
- TextServicesDisplayAttribute.cs
- GeneralTransformGroup.cs
- BatchStream.cs
- TagMapCollection.cs
- CompilationSection.cs
- Fault.cs
- DataRecordInternal.cs
- xmlfixedPageInfo.cs
- BorderSidesEditor.cs
- AccessDataSourceView.cs
- XPathDocumentIterator.cs
- DataGridViewImageCell.cs
- BindStream.cs
- ConfigurationProperty.cs
- AxHostDesigner.cs
- XmlAttributeAttribute.cs
- SystemParameters.cs
- DefaultHttpHandler.cs
- OutgoingWebRequestContext.cs
- AssemblyName.cs
- DateTimeSerializationSection.cs
- ProxyHwnd.cs
- SR.cs
- Registry.cs
- CollectionTypeElement.cs
- CommentEmitter.cs
- GrammarBuilderWildcard.cs
- hresults.cs
- PropertiesTab.cs
- XPathAncestorQuery.cs
- XsltInput.cs
- ToolStripDropDownClosedEventArgs.cs
- WS2007HttpBindingElement.cs
- SafeArrayTypeMismatchException.cs
- GPPOINTF.cs
- DateTimeFormatInfo.cs
- SQLChars.cs
- LinqDataSourceStatusEventArgs.cs
- MsdtcWrapper.cs
- CombinedGeometry.cs
- StylusOverProperty.cs
- SortFieldComparer.cs
- HitTestParameters3D.cs
- WebEventCodes.cs
- ObjectHandle.cs
- SafeRightsManagementHandle.cs
- HybridObjectCache.cs
- BitmapEffectGeneralTransform.cs
- ToolStripItemBehavior.cs
- OleDbParameterCollection.cs
- UidPropertyAttribute.cs
- TextTreeObjectNode.cs
- StateManagedCollection.cs
- SpnEndpointIdentityExtension.cs
- PasswordTextContainer.cs
- RequiredFieldValidator.cs
- PreviewKeyDownEventArgs.cs
- MsmqOutputChannel.cs
- BufferedStream.cs
- BinaryCommonClasses.cs
- XmlSerializationWriter.cs
- FixedMaxHeap.cs
- DetailsViewActionList.cs