Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Services / Messaging / System / Messaging / Interop / Columns.cs / 1305376 / Columns.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Messaging.Interop { using System.Runtime.InteropServices; using System.Diagnostics; using System; using System.ComponentModel; using System.Globalization; //for CultureInfo using Microsoft.Win32; internal class Columns { private int maxCount; private MQCOLUMNSET columnSet = new MQCOLUMNSET(); public Columns(int maxCount) { this.maxCount = maxCount; this.columnSet.columnIdentifiers = Marshal.AllocHGlobal(maxCount * 4); this.columnSet.columnCount = 0; } public virtual void AddColumnId(int columnId) { lock(this) { if (this.columnSet.columnCount >= this.maxCount) throw new InvalidOperationException(Res.GetString(Res.TooManyColumns, this.maxCount.ToString(CultureInfo.CurrentCulture))); ++ this.columnSet.columnCount; this.columnSet.SetId(columnId, this.columnSet.columnCount - 1); } } public virtual MQCOLUMNSET GetColumnsRef() { return this.columnSet; } [StructLayout(LayoutKind.Sequential)] public class MQCOLUMNSET{ public int columnCount; [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources")] public IntPtr columnIdentifiers; ~MQCOLUMNSET() { if (this.columnIdentifiers != (IntPtr)0) { Marshal.FreeHGlobal(this.columnIdentifiers); this.columnIdentifiers = (IntPtr)0; } } public virtual void SetId(int columnId, int index) { Marshal.WriteInt32((IntPtr)((long)this.columnIdentifiers + (index * 4)), columnId); } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Messaging.Interop { using System.Runtime.InteropServices; using System.Diagnostics; using System; using System.ComponentModel; using System.Globalization; //for CultureInfo using Microsoft.Win32; internal class Columns { private int maxCount; private MQCOLUMNSET columnSet = new MQCOLUMNSET(); public Columns(int maxCount) { this.maxCount = maxCount; this.columnSet.columnIdentifiers = Marshal.AllocHGlobal(maxCount * 4); this.columnSet.columnCount = 0; } public virtual void AddColumnId(int columnId) { lock(this) { if (this.columnSet.columnCount >= this.maxCount) throw new InvalidOperationException(Res.GetString(Res.TooManyColumns, this.maxCount.ToString(CultureInfo.CurrentCulture))); ++ this.columnSet.columnCount; this.columnSet.SetId(columnId, this.columnSet.columnCount - 1); } } public virtual MQCOLUMNSET GetColumnsRef() { return this.columnSet; } [StructLayout(LayoutKind.Sequential)] public class MQCOLUMNSET{ public int columnCount; [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2006:UseSafeHandleToEncapsulateNativeResources")] public IntPtr columnIdentifiers; ~MQCOLUMNSET() { if (this.columnIdentifiers != (IntPtr)0) { Marshal.FreeHGlobal(this.columnIdentifiers); this.columnIdentifiers = (IntPtr)0; } } public virtual void SetId(int columnId, int index) { Marshal.WriteInt32((IntPtr)((long)this.columnIdentifiers + (index * 4)), columnId); } } } } // 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
- SHA1.cs
- DataGridViewCellToolTipTextNeededEventArgs.cs
- Deflater.cs
- SocketPermission.cs
- NativeObjectSecurity.cs
- ZoneLinkButton.cs
- DoubleLinkList.cs
- ServicesUtilities.cs
- ListenerTraceUtility.cs
- EventManager.cs
- HttpChannelHelper.cs
- DragStartedEventArgs.cs
- SignatureDescription.cs
- CommunicationObjectManager.cs
- _TransmitFileOverlappedAsyncResult.cs
- CheckoutException.cs
- SymbolTable.cs
- TextPenaltyModule.cs
- HostingEnvironmentWrapper.cs
- FormViewCommandEventArgs.cs
- TaiwanLunisolarCalendar.cs
- EntitySetBase.cs
- NotifyParentPropertyAttribute.cs
- PtsCache.cs
- EventDescriptor.cs
- TextPatternIdentifiers.cs
- Cursor.cs
- ToolstripProfessionalRenderer.cs
- CoTaskMemHandle.cs
- IdentityManager.cs
- DynamicResourceExtension.cs
- StateItem.cs
- Point3DConverter.cs
- httpserverutility.cs
- SettingsPropertyNotFoundException.cs
- DataObjectFieldAttribute.cs
- CheckBox.cs
- TypeSystem.cs
- SqlReorderer.cs
- ColorConverter.cs
- MissingSatelliteAssemblyException.cs
- MemberCollection.cs
- IISUnsafeMethods.cs
- ConfigXmlSignificantWhitespace.cs
- ColumnMapVisitor.cs
- XhtmlBasicCommandAdapter.cs
- FunctionImportMapping.cs
- HandlerBase.cs
- ImageResources.Designer.cs
- DiagnosticTraceRecords.cs
- OLEDB_Util.cs
- Command.cs
- TablePattern.cs
- VisualStyleInformation.cs
- GregorianCalendarHelper.cs
- WebServiceHandlerFactory.cs
- HitTestResult.cs
- TextTreeRootNode.cs
- ISCIIEncoding.cs
- PropertySet.cs
- SchemaElementLookUpTable.cs
- CodeRemoveEventStatement.cs
- SHA256Cng.cs
- ConstructorBuilder.cs
- RSAPKCS1KeyExchangeDeformatter.cs
- FileAuthorizationModule.cs
- WebConfigurationManager.cs
- InternalPermissions.cs
- MiniLockedBorderGlyph.cs
- SystemWebExtensionsSectionGroup.cs
- TypeListConverter.cs
- TemplateModeChangedEventArgs.cs
- QilXmlReader.cs
- Translator.cs
- XmlConvert.cs
- ProcessManager.cs
- CompensationHandlingFilter.cs
- TranslateTransform3D.cs
- DiagnosticTraceRecords.cs
- CreateUserWizard.cs
- Animatable.cs
- RectKeyFrameCollection.cs
- ToolStripDropDown.cs
- SqlFunctionAttribute.cs
- SessionEndingCancelEventArgs.cs
- FacetDescription.cs
- Directory.cs
- TextElement.cs
- SpeechEvent.cs
- PingReply.cs
- WorkflowViewStateService.cs
- StaticResourceExtension.cs
- ApplicationSecurityManager.cs
- ListItemDetailViewAttribute.cs
- HashRepartitionEnumerator.cs
- LexicalChunk.cs
- ConnectionOrientedTransportChannelListener.cs
- SizeIndependentAnimationStorage.cs
- DataSourceControl.cs
- DataGridColumnDropSeparator.cs