Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Core / System / Diagnostics / Eventing / Reader / EventLevel.cs / 1305376 / EventLevel.cs
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== /*============================================================ ** ** Class: EventLevel ** ** Purpose: ** This public class describes the metadata for a specific Level ** defined by a Provider. An instance of this class is obtained from ** a ProviderMetadata object. ** ============================================================*/ using System.Collections.Generic; namespace System.Diagnostics.Eventing.Reader { ////// Describes the metadata for a specific Level defined by a Provider. /// An instance of this class is obtained from a ProviderMetadata object. /// [System.Security.Permissions.HostProtection(MayLeakOnAbort = true)] public sealed class EventLevel { private int value; private string name; private string displayName; private bool dataReady; ProviderMetadata pmReference; object syncObject; //called from EventMetadata internal EventLevel(int value, ProviderMetadata pmReference) { this.value = value; this.pmReference = pmReference; this.syncObject = new object(); } //called from ProviderMetadata internal EventLevel(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() { if (dataReady == true) return; lock (syncObject) { if (dataReady == true) return; IEnumerableresult = pmReference.Levels; this.name = null; this.displayName = null; this.dataReady = true; foreach (EventLevel lev in result) { if (lev.Value == this.value) { this.name = lev.Name; this.displayName = lev.DisplayName; break; } } } } 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: EventLevel ** ** Purpose: ** This public class describes the metadata for a specific Level ** defined by a Provider. An instance of this class is obtained from ** a ProviderMetadata object. ** ============================================================*/ using System.Collections.Generic; namespace System.Diagnostics.Eventing.Reader { /// /// Describes the metadata for a specific Level defined by a Provider. /// An instance of this class is obtained from a ProviderMetadata object. /// [System.Security.Permissions.HostProtection(MayLeakOnAbort = true)] public sealed class EventLevel { private int value; private string name; private string displayName; private bool dataReady; ProviderMetadata pmReference; object syncObject; //called from EventMetadata internal EventLevel(int value, ProviderMetadata pmReference) { this.value = value; this.pmReference = pmReference; this.syncObject = new object(); } //called from ProviderMetadata internal EventLevel(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() { if (dataReady == true) return; lock (syncObject) { if (dataReady == true) return; IEnumerableresult = pmReference.Levels; this.name = null; this.displayName = null; this.dataReady = true; foreach (EventLevel lev in result) { if (lev.Value == this.value) { this.name = lev.Name; this.displayName = lev.DisplayName; break; } } } } 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
- LicenseException.cs
- DNS.cs
- RuntimeConfigurationRecord.cs
- TraceHandler.cs
- CacheOutputQuery.cs
- ExportException.cs
- DataGridViewImageColumn.cs
- StrongNameMembershipCondition.cs
- WaitHandleCannotBeOpenedException.cs
- StyleXamlTreeBuilder.cs
- PropertyGridDesigner.cs
- FunctionCommandText.cs
- UIElement3D.cs
- CurrentChangingEventArgs.cs
- DispatcherEventArgs.cs
- TTSEngineProxy.cs
- WindowsEditBoxRange.cs
- RepeatButton.cs
- CollectionViewGroupInternal.cs
- LinearGradientBrush.cs
- ListParagraph.cs
- FrameworkPropertyMetadata.cs
- CompressedStack.cs
- CustomTokenProvider.cs
- ProcessHostMapPath.cs
- RequiredAttributeAttribute.cs
- DrawingContextDrawingContextWalker.cs
- ReferenceAssemblyAttribute.cs
- SaveFileDialogDesigner.cs
- SolidColorBrush.cs
- ConnectionInterfaceCollection.cs
- XmlFormatWriterGenerator.cs
- UrlAuthorizationModule.cs
- FileDialogPermission.cs
- LZCodec.cs
- SecurityUtils.cs
- XmlDocumentType.cs
- CharacterString.cs
- ListBoxItemAutomationPeer.cs
- processwaithandle.cs
- LocalizationComments.cs
- SafeHandles.cs
- BinaryNode.cs
- DockProviderWrapper.cs
- PersonalizationAdministration.cs
- FrugalList.cs
- CellParaClient.cs
- WindowsListView.cs
- HttpProfileBase.cs
- IFlowDocumentViewer.cs
- WebSysDefaultValueAttribute.cs
- XmlReaderSettings.cs
- DbCommandTree.cs
- SchemaMapping.cs
- FontUnit.cs
- MsmqIntegrationOutputChannel.cs
- ThreadInterruptedException.cs
- ReadOnlyObservableCollection.cs
- InternalBase.cs
- WebZone.cs
- Matrix.cs
- WebPartsPersonalizationAuthorization.cs
- Tile.cs
- XDRSchema.cs
- EdgeModeValidation.cs
- DesignerDataColumn.cs
- ApplicationServicesHostFactory.cs
- DecimalAnimationBase.cs
- TreeViewAutomationPeer.cs
- ToolStripDesignerAvailabilityAttribute.cs
- CustomPopupPlacement.cs
- SQLSingleStorage.cs
- MiniCustomAttributeInfo.cs
- ContractsBCL.cs
- CachedBitmap.cs
- IteratorFilter.cs
- ConvertEvent.cs
- Thumb.cs
- SendAgentStatusRequest.cs
- AssemblyBuilder.cs
- MimeTypeMapper.cs
- IncrementalCompileAnalyzer.cs
- AuthorizationSection.cs
- Int16.cs
- arclist.cs
- SafeWaitHandle.cs
- TextChangedEventArgs.cs
- MediaElementAutomationPeer.cs
- ConsumerConnectionPoint.cs
- CfgArc.cs
- RootBrowserWindowAutomationPeer.cs
- FloaterParaClient.cs
- UserControlParser.cs
- MediaElement.cs
- TdsParserHelperClasses.cs
- XsdBuildProvider.cs
- XmlSerializationWriter.cs
- ControlPaint.cs
- ContextMenu.cs
- OracleCommand.cs