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
- WebControl.cs
- WindowsScroll.cs
- WeakHashtable.cs
- WebServicesDescriptionAttribute.cs
- ClosableStream.cs
- ObjectListItemCollection.cs
- EntityModelBuildProvider.cs
- TdsParserSafeHandles.cs
- PlatformNotSupportedException.cs
- StringInfo.cs
- TrustLevelCollection.cs
- TextDocumentView.cs
- ValidationHelpers.cs
- XmlSchemaInclude.cs
- OptimalTextSource.cs
- ThreadAbortException.cs
- ConfigurationManagerInternalFactory.cs
- SiteMapNodeItemEventArgs.cs
- RetrieveVirtualItemEventArgs.cs
- XmlElementAttributes.cs
- GAC.cs
- DataRowView.cs
- OverflowException.cs
- ProgramNode.cs
- safePerfProviderHandle.cs
- GridViewRowCollection.cs
- AlphaSortedEnumConverter.cs
- TimeSpanMinutesConverter.cs
- ProtocolsConfigurationEntry.cs
- Int32.cs
- StringUtil.cs
- GPStream.cs
- ParseNumbers.cs
- Compiler.cs
- DeflateEmulationStream.cs
- DataViewManager.cs
- SecondaryIndexDefinition.cs
- DirtyTextRange.cs
- COM2IProvidePropertyBuilderHandler.cs
- MDIWindowDialog.cs
- MergeFilterQuery.cs
- EntityDataSourceDataSelection.cs
- SQLGuid.cs
- NamespaceInfo.cs
- AnimationException.cs
- XmlIterators.cs
- MemoryMappedFile.cs
- Misc.cs
- BufferedMessageWriter.cs
- WorkflowViewStateService.cs
- SqlTypesSchemaImporter.cs
- EntityDataSourceDataSelection.cs
- ContextMenuStrip.cs
- BinaryMethodMessage.cs
- ColorConverter.cs
- TextBoxRenderer.cs
- ControllableStoryboardAction.cs
- Compiler.cs
- XPathSelectionIterator.cs
- FixedSOMImage.cs
- XhtmlConformanceSection.cs
- OperationDescriptionCollection.cs
- XmlWrappingReader.cs
- ParenthesizePropertyNameAttribute.cs
- MenuAdapter.cs
- DependencyObjectProvider.cs
- AspNetPartialTrustHelpers.cs
- PublisherIdentityPermission.cs
- GridSplitter.cs
- CallSiteHelpers.cs
- ParamArrayAttribute.cs
- CodeTypeMemberCollection.cs
- HMAC.cs
- OleDbStruct.cs
- TextParagraphProperties.cs
- BitmapCodecInfo.cs
- BamlTreeUpdater.cs
- ExtendedPropertyDescriptor.cs
- SmiRequestExecutor.cs
- tibetanshape.cs
- TextEndOfLine.cs
- XmlEventCache.cs
- ThrowHelper.cs
- IntSecurity.cs
- DataSpaceManager.cs
- WebServiceData.cs
- CacheForPrimitiveTypes.cs
- DataGridCell.cs
- basecomparevalidator.cs
- TextBlockAutomationPeer.cs
- RouteItem.cs
- SqlDependencyListener.cs
- WindowsStatic.cs
- ProfilePropertySettingsCollection.cs
- BuildProvider.cs
- _NativeSSPI.cs
- DesignerEditorPartChrome.cs
- SQLConvert.cs
- HtmlTable.cs
- TrackBarRenderer.cs