Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Core / System / Diagnostics / Eventing / Reader / EventOpcode.cs / 1305376 / EventOpcode.cs
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== /*============================================================ ** ** Class: EventOpcode ** ** Purpose: ** This public class describes the metadata for a specific Opcode ** defined by a Provider. An instance of this class is obtained from ** a ProviderMetadata object. ** ============================================================*/ using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; namespace System.Diagnostics.Eventing.Reader { [System.Security.Permissions.HostProtection(MayLeakOnAbort = true)] [SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly", MessageId = "Opcode", Justification = "[....]: Shipped public in 3.5, breaking change to fix now.")] public sealed class EventOpcode { private int value; private string name; private string displayName; private bool dataReady; ProviderMetadata pmReference; object syncObject; //call from EventMetadata internal EventOpcode(int value, ProviderMetadata pmReference) { this.value = value; this.pmReference = pmReference; this.syncObject = new object(); } //call from ProviderMetadata internal EventOpcode(string name, int value, string displayName) { this.value = value; this.name = name; this.displayName = displayName; this.dataReady = true; this.syncObject = new object(); } internal void PrepareData() { lock (syncObject) { if (dataReady == true) return; // get the data IEnumerableresult = pmReference.Opcodes; //set the names and display names to null this.name = null; this.displayName = null; this.dataReady = true; foreach (EventOpcode op in result) { if (op.Value == this.value) { this.name = op.Name; this.displayName = op.DisplayName; this.dataReady = true; break; } } } }//End Prepare Data public string Name { get { PrepareData(); return this.name; } } public int Value { get { return this.value; } } public string DisplayName { get { PrepareData(); return this.displayName; } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== /*============================================================ ** ** Class: EventOpcode ** ** Purpose: ** This public class describes the metadata for a specific Opcode ** defined by a Provider. An instance of this class is obtained from ** a ProviderMetadata object. ** ============================================================*/ using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; namespace System.Diagnostics.Eventing.Reader { [System.Security.Permissions.HostProtection(MayLeakOnAbort = true)] [SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly", MessageId = "Opcode", Justification = "[....]: Shipped public in 3.5, breaking change to fix now.")] public sealed class EventOpcode { private int value; private string name; private string displayName; private bool dataReady; ProviderMetadata pmReference; object syncObject; //call from EventMetadata internal EventOpcode(int value, ProviderMetadata pmReference) { this.value = value; this.pmReference = pmReference; this.syncObject = new object(); } //call from ProviderMetadata internal EventOpcode(string name, int value, string displayName) { this.value = value; this.name = name; this.displayName = displayName; this.dataReady = true; this.syncObject = new object(); } internal void PrepareData() { lock (syncObject) { if (dataReady == true) return; // get the data IEnumerable result = pmReference.Opcodes; //set the names and display names to null this.name = null; this.displayName = null; this.dataReady = true; foreach (EventOpcode op in result) { if (op.Value == this.value) { this.name = op.Name; this.displayName = op.DisplayName; this.dataReady = true; break; } } } }//End Prepare Data public string Name { get { PrepareData(); return this.name; } } public int Value { get { return this.value; } } public string DisplayName { get { PrepareData(); return this.displayName; } } } } // 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
- ActivationProxy.cs
- CFStream.cs
- StructuralObject.cs
- MimeMapping.cs
- AvTraceFormat.cs
- WebPartConnectionsCancelEventArgs.cs
- XD.cs
- Funcletizer.cs
- RangeEnumerable.cs
- EntityTypeEmitter.cs
- DbModificationClause.cs
- StackOverflowException.cs
- RedistVersionInfo.cs
- UnmanagedMemoryStreamWrapper.cs
- ContextMenuStrip.cs
- WeakEventManager.cs
- AutomationIdentifier.cs
- ImageConverter.cs
- XmlBinaryWriterSession.cs
- ScrollContentPresenter.cs
- RequestStatusBarUpdateEventArgs.cs
- WeakReference.cs
- XmlNamedNodeMap.cs
- BinaryHeap.cs
- UrlEncodedParameterWriter.cs
- IxmlLineInfo.cs
- MultiTrigger.cs
- XmlBinaryReader.cs
- WindowsSlider.cs
- _KerberosClient.cs
- ButtonBase.cs
- ToolStripArrowRenderEventArgs.cs
- ExecutionEngineException.cs
- PartitionResolver.cs
- ActivityExecutorOperation.cs
- X509Certificate2Collection.cs
- Line.cs
- SequenceDesigner.cs
- HttpListener.cs
- BamlLocalizationDictionary.cs
- SharedUtils.cs
- ButtonColumn.cs
- GridEntry.cs
- UpdateProgress.cs
- SecurityPermission.cs
- ProxyDataContractResolver.cs
- EditModeSwitchButton.cs
- ToolTip.cs
- processwaithandle.cs
- ImplicitInputBrush.cs
- HeaderPanel.cs
- CharacterBuffer.cs
- SystemWebSectionGroup.cs
- ApplicationHost.cs
- DiscoveryEndpoint.cs
- ObjectQueryExecutionPlan.cs
- WSTrustDec2005.cs
- _BaseOverlappedAsyncResult.cs
- XpsFixedPageReaderWriter.cs
- DebuggerAttributes.cs
- MultiDataTrigger.cs
- AssociationSetEnd.cs
- Timer.cs
- DetailsViewUpdatedEventArgs.cs
- PageFunction.cs
- WebPartManagerInternals.cs
- EventSource.cs
- DataList.cs
- DbConvert.cs
- TreeViewEvent.cs
- COM2FontConverter.cs
- MetadataUtil.cs
- XPathDocumentNavigator.cs
- BindingCollection.cs
- SmiEventStream.cs
- NewArrayExpression.cs
- DataGridViewAutoSizeColumnsModeEventArgs.cs
- OutputCacheModule.cs
- TextFormatter.cs
- ServiceAuthorizationBehavior.cs
- RelationshipWrapper.cs
- ContractAdapter.cs
- DataGridViewCellValueEventArgs.cs
- SqlAggregateChecker.cs
- XPathArrayIterator.cs
- clipboard.cs
- ToolBarPanel.cs
- XmlDocumentSchema.cs
- DataObjectAttribute.cs
- MethodSignatureGenerator.cs
- ObjectDisposedException.cs
- SpellerInterop.cs
- InlineCollection.cs
- ViewService.cs
- ValidationSummary.cs
- ArrayWithOffset.cs
- OdbcHandle.cs
- SHA512Managed.cs
- CodeVariableDeclarationStatement.cs
- OperationFormatUse.cs