Code:
/ 4.0 / 4.0 / untmp / 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
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
- XmlElementAttributes.cs
- SerializationException.cs
- DuplexClientBase.cs
- XPathScanner.cs
- TreeBuilder.cs
- WindowInteractionStateTracker.cs
- PrincipalPermissionMode.cs
- ModelPerspective.cs
- TreeNodeStyleCollection.cs
- PenContexts.cs
- CodeIdentifier.cs
- FixedStringLookup.cs
- PackUriHelper.cs
- UnsafePeerToPeerMethods.cs
- MimeTextImporter.cs
- InstanceNotReadyException.cs
- RegisteredExpandoAttribute.cs
- BulletChrome.cs
- ToolConsole.cs
- IconHelper.cs
- Matrix.cs
- StyleModeStack.cs
- TableSectionStyle.cs
- CreateUserErrorEventArgs.cs
- ObjectStateEntry.cs
- RestHandler.cs
- TimestampInformation.cs
- ViewRendering.cs
- TextEffectResolver.cs
- AttributeCollection.cs
- PolicyVersion.cs
- ConfigurationElementProperty.cs
- ImpersonationContext.cs
- PreviewPrintController.cs
- XamlSerializerUtil.cs
- WebGetAttribute.cs
- MgmtConfigurationRecord.cs
- DoubleCollection.cs
- ClientSettingsProvider.cs
- ArrayList.cs
- SQLChars.cs
- TableLayoutStyle.cs
- DataGridViewAccessibleObject.cs
- CheckBoxRenderer.cs
- ConnectionPoolManager.cs
- ServiceContractAttribute.cs
- Options.cs
- AutomationElementCollection.cs
- QilNode.cs
- CodeStatement.cs
- BitmapSource.cs
- CmsInterop.cs
- _LazyAsyncResult.cs
- CompareInfo.cs
- TaskDesigner.cs
- DSASignatureFormatter.cs
- XmlSchemaSubstitutionGroup.cs
- CustomAttributeFormatException.cs
- ByteStack.cs
- GenericTypeParameterConverter.cs
- DiscoveryDocumentReference.cs
- Lazy.cs
- MethodCallExpression.cs
- ButtonBaseAdapter.cs
- CodeBlockBuilder.cs
- DataObjectEventArgs.cs
- Variant.cs
- CorrelationActionMessageFilter.cs
- RegexCharClass.cs
- RefType.cs
- cookie.cs
- Vector3DCollectionValueSerializer.cs
- WindowsBrush.cs
- ProgressPage.cs
- FontUnit.cs
- TrimSurroundingWhitespaceAttribute.cs
- DataGrid.cs
- UpDownEvent.cs
- KnownTypeAttribute.cs
- EUCJPEncoding.cs
- SqlDataSourceQuery.cs
- SmiTypedGetterSetter.cs
- SplashScreenNativeMethods.cs
- ContextMenuStrip.cs
- ISFTagAndGuidCache.cs
- TreeNodeCollectionEditorDialog.cs
- serverconfig.cs
- HttpRequestWrapper.cs
- WorkflowRequestContext.cs
- RowBinding.cs
- MonthCalendar.cs
- Site.cs
- AssertHelper.cs
- XPathNavigatorReader.cs
- BuildManager.cs
- SHA256.cs
- Script.cs
- SingleSelectRootGridEntry.cs
- IteratorFilter.cs
- versioninfo.cs