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
- JsonEnumDataContract.cs
- XPathScanner.cs
- FactoryMaker.cs
- HttpListener.cs
- XmlAttributeOverrides.cs
- XsltLoader.cs
- StringDictionary.cs
- Exceptions.cs
- AutoResizedEvent.cs
- StyleCollectionEditor.cs
- TabPanel.cs
- ComNativeDescriptor.cs
- ObjectDataSourceStatusEventArgs.cs
- FeatureAttribute.cs
- TypeElement.cs
- _AutoWebProxyScriptEngine.cs
- TextTreeObjectNode.cs
- StagingAreaInputItem.cs
- UnsafeNativeMethodsMilCoreApi.cs
- RuleSetBrowserDialog.cs
- AddInProcess.cs
- COM2TypeInfoProcessor.cs
- AttributeCollection.cs
- DataGridSortCommandEventArgs.cs
- InertiaExpansionBehavior.cs
- PluralizationService.cs
- ObjRef.cs
- TypeForwardedToAttribute.cs
- Automation.cs
- _NetRes.cs
- SyntaxCheck.cs
- XmlUnspecifiedAttribute.cs
- HtmlShim.cs
- ListItemCollection.cs
- HttpModuleActionCollection.cs
- MgmtConfigurationRecord.cs
- Enlistment.cs
- XmlSchemaException.cs
- PixelShader.cs
- StrongNameSignatureInformation.cs
- RowUpdatingEventArgs.cs
- Encoding.cs
- PageSetupDialog.cs
- TextTreePropertyUndoUnit.cs
- EnvironmentPermission.cs
- Span.cs
- FilePresentation.cs
- XsltSettings.cs
- ProtocolProfile.cs
- DataGridViewCellParsingEventArgs.cs
- Oid.cs
- TypeNameConverter.cs
- Cloud.cs
- WindowsGraphics2.cs
- HttpSessionStateBase.cs
- TypeDescriptor.cs
- PagerSettings.cs
- XmlHierarchicalEnumerable.cs
- DescriptionAttribute.cs
- ToolboxItemAttribute.cs
- ObjectHandle.cs
- List.cs
- Utils.cs
- SelectionHighlightInfo.cs
- _FtpControlStream.cs
- ConcurrentStack.cs
- XmlDataSourceNodeDescriptor.cs
- PrintPreviewDialog.cs
- MultidimensionalArrayItemReference.cs
- BamlRecordWriter.cs
- EventLogStatus.cs
- RootBrowserWindowProxy.cs
- CatalogPart.cs
- EdmRelationshipNavigationPropertyAttribute.cs
- ResourceProviderFactory.cs
- TemplateApplicationHelper.cs
- GeometryDrawing.cs
- CustomCredentialPolicy.cs
- sqlcontext.cs
- ClientScriptManagerWrapper.cs
- SqlStatistics.cs
- Int64KeyFrameCollection.cs
- WebPartEditVerb.cs
- TimeSpanMinutesOrInfiniteConverter.cs
- WindowsMenu.cs
- ProtocolsConfigurationEntry.cs
- DecimalFormatter.cs
- DataControlFieldCell.cs
- RenderingEventArgs.cs
- Pen.cs
- ManifestSignedXml.cs
- ExtendLockCommand.cs
- Lease.cs
- ApplicationManager.cs
- NamespaceMapping.cs
- DeflateEmulationStream.cs
- SelectedDatesCollection.cs
- CommandPlan.cs
- VariableReference.cs
- AuthenticationConfig.cs