Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / WCF / infocard / Client / System / IdentityModel / Selectors / PolicyChain.cs / 1305376 / 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- TableRowsCollectionEditor.cs
- ScrollProperties.cs
- DBDataPermission.cs
- TreeViewCancelEvent.cs
- Context.cs
- DataFormat.cs
- Compiler.cs
- DESCryptoServiceProvider.cs
- OutputCacheSettings.cs
- DataGridColumnCollection.cs
- LayoutExceptionEventArgs.cs
- XmlDataProvider.cs
- EventProviderWriter.cs
- DataGridViewAdvancedBorderStyle.cs
- UrlPath.cs
- EnterpriseServicesHelper.cs
- LineProperties.cs
- LassoSelectionBehavior.cs
- DetailsViewModeEventArgs.cs
- ConfigurationStrings.cs
- ScrollBarRenderer.cs
- RegistryHandle.cs
- PowerStatus.cs
- PeerToPeerException.cs
- LicenseException.cs
- FormsAuthenticationEventArgs.cs
- ConnectionOrientedTransportChannelListener.cs
- MexServiceChannelBuilder.cs
- Menu.cs
- SpeakProgressEventArgs.cs
- SQLSingleStorage.cs
- NameHandler.cs
- ListBase.cs
- AlternationConverter.cs
- DataGridLinkButton.cs
- HierarchicalDataTemplate.cs
- X509ClientCertificateAuthenticationElement.cs
- MorphHelper.cs
- CacheHelper.cs
- IConvertible.cs
- XpsFont.cs
- SessionStateModule.cs
- ProcessHostFactoryHelper.cs
- TriggerActionCollection.cs
- MonitorWrapper.cs
- Accessors.cs
- HtmlAnchor.cs
- CryptographicAttribute.cs
- CodeMemberProperty.cs
- NavigationWindow.cs
- infer.cs
- ServiceDurableInstance.cs
- CharAnimationUsingKeyFrames.cs
- BlockCollection.cs
- CryptoApi.cs
- WebServiceClientProxyGenerator.cs
- OleDbDataAdapter.cs
- NativeMethods.cs
- PropertyGridCommands.cs
- ListDictionary.cs
- DbConvert.cs
- HttpListenerPrefixCollection.cs
- AppDomainManager.cs
- HttpValueCollection.cs
- TextDataBindingHandler.cs
- SmiRequestExecutor.cs
- QuaternionAnimation.cs
- TransformValueSerializer.cs
- WorkflowRuntimeService.cs
- CollectionCodeDomSerializer.cs
- ListBoxItemAutomationPeer.cs
- ProfileProvider.cs
- DataColumnPropertyDescriptor.cs
- updatecommandorderer.cs
- ResourceBinder.cs
- GuidelineCollection.cs
- adornercollection.cs
- XmlDictionary.cs
- StringInfo.cs
- HttpPostClientProtocol.cs
- WebPartDeleteVerb.cs
- GraphicsState.cs
- MetaData.cs
- Cursors.cs
- CodeVariableDeclarationStatement.cs
- DomainConstraint.cs
- Formatter.cs
- IApplicationTrustManager.cs
- StorageSetMapping.cs
- QuaternionRotation3D.cs
- RadioButtonStandardAdapter.cs
- RankException.cs
- ToolStripProfessionalLowResolutionRenderer.cs
- CultureInfo.cs
- DataGridViewCellValidatingEventArgs.cs
- GuidConverter.cs
- DbTransaction.cs
- WebPartEditorOkVerb.cs
- WCFBuildProvider.cs
- RequestQueryProcessor.cs