Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / infocard / Client / System / IdentityModel / Selectors / PolicyChain.cs / 1 / PolicyChain.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace System.IdentityModel.Selectors { using System; using System.Collections.Generic; using System.IO; using System.Runtime.InteropServices; using System.Text; using System.Xml; // // For common // using Microsoft.InfoCards; // // Summary: // This class wraps and manages the lifetime of an array of PolicyElements that are to be Marshaled to // native memory. // internal class PolicyChain : IDisposable { HGlobalSafeHandle m_nativeChain; InternalPolicyElement[] m_chain; public int Length { get { return m_chain.Length; } } public PolicyChain( CardSpacePolicyElement[ ] elements ) { int length = elements.Length; m_chain = new InternalPolicyElement[ length ]; for( int i = 0; i < length; i++ ) { m_chain[ i ] = new InternalPolicyElement( elements[ i ] ); } } public SafeHandle DoMarshal() { if( null == m_nativeChain ) { int elementSize = InternalPolicyElement.Size; int chainLength = m_chain.Length; m_nativeChain = HGlobalSafeHandle.Construct( chainLength * elementSize ); IntPtr pos = m_nativeChain.DangerousGetHandle(); foreach( InternalPolicyElement element in m_chain ) { element.DoMarshal( pos ); unsafe { // // All this just to do pos += elementSize // pos = new IntPtr( (long)( ( (ulong) pos.ToPointer() ) + (ulong) elementSize ) ); } } } return m_nativeChain; } public void Dispose() { Dispose( true ); } ~PolicyChain() { Dispose( false ); } private void Dispose( bool disposing ) { if( disposing ) { GC.SuppressFinalize( this ); } if( null != m_chain ) { foreach( InternalPolicyElement element in m_chain ) { if( null != element ) { element.Dispose(); } } m_chain = null; } if( null != m_nativeChain ) { m_nativeChain.Dispose(); } } } } // 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
- ParserStreamGeometryContext.cs
- ElementNotEnabledException.cs
- IgnoreFileBuildProvider.cs
- CompareValidator.cs
- FastPropertyAccessor.cs
- PointCollectionValueSerializer.cs
- Simplifier.cs
- RadioButtonList.cs
- PlaceHolder.cs
- WebPartActionVerb.cs
- NotFiniteNumberException.cs
- XhtmlCssHandler.cs
- EventLogPermissionEntry.cs
- SignedPkcs7.cs
- LinqToSqlWrapper.cs
- PolyBezierSegment.cs
- DurableInstancingOptions.cs
- LoginNameDesigner.cs
- FlowDocumentScrollViewer.cs
- Utils.cs
- XmlNavigatorStack.cs
- TabItemAutomationPeer.cs
- EventPrivateKey.cs
- BitmapCodecInfoInternal.cs
- ThreadStartException.cs
- PageSetupDialog.cs
- URIFormatException.cs
- StorageRoot.cs
- ScriptModule.cs
- StorageRoot.cs
- DbgUtil.cs
- XmlMtomWriter.cs
- BypassElement.cs
- WebPartConnectionsConnectVerb.cs
- UrlPropertyAttribute.cs
- BitmapCodecInfo.cs
- EventsTab.cs
- StreamWriter.cs
- ImageAnimator.cs
- CodeRegionDirective.cs
- DataColumnMapping.cs
- ToolStripDropTargetManager.cs
- ResolveNameEventArgs.cs
- recordstate.cs
- HiddenFieldDesigner.cs
- securitycriticaldata.cs
- GAC.cs
- EndpointConfigContainer.cs
- ToolStripHighContrastRenderer.cs
- ComPlusAuthorization.cs
- ToolStripOverflowButton.cs
- SiteMapDataSourceView.cs
- DocumentOrderQuery.cs
- Literal.cs
- Message.cs
- VarInfo.cs
- DomNameTable.cs
- SAPIEngineTypes.cs
- DataGridViewCellStyleContentChangedEventArgs.cs
- DataServiceSaveChangesEventArgs.cs
- AttachedAnnotationChangedEventArgs.cs
- KeySplineConverter.cs
- SoapHeaderAttribute.cs
- TreeNodeCollection.cs
- WebResourceUtil.cs
- DependencyPropertyValueSerializer.cs
- RemotingConfiguration.cs
- XmlSubtreeReader.cs
- CalendarData.cs
- TextViewElement.cs
- Activator.cs
- NameScopePropertyAttribute.cs
- HuffModule.cs
- LabelEditEvent.cs
- RenderDataDrawingContext.cs
- UnsafeNativeMethods.cs
- HiddenFieldDesigner.cs
- OverflowException.cs
- SiteMembershipCondition.cs
- XmlSecureResolver.cs
- App.cs
- SHA512Cng.cs
- SerTrace.cs
- DateRangeEvent.cs
- DrawingState.cs
- List.cs
- ListControlActionList.cs
- DataViewListener.cs
- LookupNode.cs
- Stackframe.cs
- XmlEntity.cs
- TreeNodeStyle.cs
- XmlSchemaGroup.cs
- DataGridColumnCollection.cs
- TrackingQueryElement.cs
- SafeLocalAllocation.cs
- CompressionTracing.cs
- SerializationTrace.cs
- PassportAuthentication.cs
- ConfigurationManagerInternal.cs