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
- GlyphCollection.cs
- SwitchElementsCollection.cs
- PointLight.cs
- RegexNode.cs
- WebPartConnectionsCancelEventArgs.cs
- PopupControlService.cs
- Accessors.cs
- TabControlEvent.cs
- ToolboxItem.cs
- PerformanceCountersElement.cs
- ElementNotEnabledException.cs
- Menu.cs
- PublisherMembershipCondition.cs
- IncrementalCompileAnalyzer.cs
- ParseElementCollection.cs
- rsa.cs
- RefreshEventArgs.cs
- BitmapEffectDrawing.cs
- ListDesigner.cs
- Decoder.cs
- DataBindingCollectionEditor.cs
- Menu.cs
- SortQuery.cs
- GregorianCalendar.cs
- PtsContext.cs
- AVElementHelper.cs
- AuthenticationModulesSection.cs
- GeneralTransform.cs
- _Win32.cs
- LinqDataSourceHelper.cs
- IFlowDocumentViewer.cs
- Automation.cs
- LayoutUtils.cs
- PageThemeParser.cs
- _SingleItemRequestCache.cs
- AttributeEmitter.cs
- AnimationException.cs
- followingsibling.cs
- _UriTypeConverter.cs
- ProjectionPathSegment.cs
- BitmapMetadata.cs
- Line.cs
- WebPermission.cs
- SafeNativeMethodsOther.cs
- InstanceOwner.cs
- NameNode.cs
- Tablet.cs
- TextModifier.cs
- TemplatedMailWebEventProvider.cs
- BaseCollection.cs
- TypeBuilder.cs
- EditorZone.cs
- SchemaImporterExtensionElementCollection.cs
- Catch.cs
- ScriptControl.cs
- _DomainName.cs
- EntityClassGenerator.cs
- ClientSettingsProvider.cs
- RangeValidator.cs
- FunctionDetailsReader.cs
- SqlDataReader.cs
- WebPartConnection.cs
- _LazyAsyncResult.cs
- BeginStoryboard.cs
- TypeToken.cs
- TypedTableBaseExtensions.cs
- ProfessionalColors.cs
- IconConverter.cs
- DirectoryNotFoundException.cs
- Attributes.cs
- TextSegment.cs
- ValueType.cs
- SHA256Managed.cs
- SecondaryIndexList.cs
- CodeThrowExceptionStatement.cs
- DateTimePicker.cs
- WebPartDisplayMode.cs
- Visitors.cs
- XmlValidatingReader.cs
- PathBox.cs
- SqlFacetAttribute.cs
- ResourceExpressionEditorSheet.cs
- StoreContentChangedEventArgs.cs
- ObjectHelper.cs
- DataRelationCollection.cs
- UxThemeWrapper.cs
- HttpStaticObjectsCollectionBase.cs
- MissingFieldException.cs
- ExecutionContext.cs
- RequiredFieldValidator.cs
- HTTPRemotingHandler.cs
- DynamicDataRouteHandler.cs
- PersistNameAttribute.cs
- AndAlso.cs
- UpdatePanelControlTrigger.cs
- QilLiteral.cs
- PaginationProgressEventArgs.cs
- PopupRootAutomationPeer.cs
- Function.cs
- RemotingException.cs