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
- SqlInternalConnection.cs
- TableLayoutPanelDesigner.cs
- CompensatableTransactionScopeActivityDesigner.cs
- XamlSerializerUtil.cs
- HyperLinkStyle.cs
- IDictionary.cs
- CallInfo.cs
- EventSourceCreationData.cs
- TypeRefElement.cs
- SafeLibraryHandle.cs
- PersonalizableTypeEntry.cs
- EventHandlersStore.cs
- BinaryUtilClasses.cs
- InkPresenter.cs
- MdiWindowListItemConverter.cs
- RootBrowserWindowProxy.cs
- OleDbReferenceCollection.cs
- SrgsSemanticInterpretationTag.cs
- XmlDictionaryReaderQuotasElement.cs
- CaretElement.cs
- ScrollBarAutomationPeer.cs
- columnmapfactory.cs
- ArrayConverter.cs
- MailWriter.cs
- DiagnosticsConfigurationHandler.cs
- SystemTcpConnection.cs
- SerializerDescriptor.cs
- Table.cs
- webeventbuffer.cs
- AnnotationAuthorChangedEventArgs.cs
- COM2IDispatchConverter.cs
- DataServiceStreamProviderWrapper.cs
- EventLogPermission.cs
- assertwrapper.cs
- ChangeNode.cs
- LayoutTableCell.cs
- NavigationProgressEventArgs.cs
- CellLabel.cs
- Variable.cs
- SiteMapNode.cs
- ExtendedPropertyInfo.cs
- SqlInternalConnection.cs
- ControlsConfig.cs
- WindowsGraphics.cs
- QueryAccessibilityHelpEvent.cs
- EllipticalNodeOperations.cs
- SQlBooleanStorage.cs
- ModelPropertyImpl.cs
- TransformerInfo.cs
- RegularExpressionValidator.cs
- XslAst.cs
- InfoCardRSACryptoProvider.cs
- DateTimeFormatInfo.cs
- httpserverutility.cs
- Menu.cs
- ArrayTypeMismatchException.cs
- DataFormat.cs
- HWStack.cs
- RegexTypeEditor.cs
- TypedReference.cs
- MissingFieldException.cs
- SQLInt32Storage.cs
- CapabilitiesUse.cs
- GeneralTransform.cs
- ArrayHelper.cs
- FixedStringLookup.cs
- EntityCommand.cs
- PlatformCulture.cs
- TextElement.cs
- JsonReader.cs
- DeobfuscatingStream.cs
- UserControl.cs
- FigureParagraph.cs
- ObjectDataSourceFilteringEventArgs.cs
- XmlSchemaAttribute.cs
- GreaterThanOrEqual.cs
- DataError.cs
- WmpBitmapDecoder.cs
- Rect3DConverter.cs
- StringExpressionSet.cs
- FileRecordSequence.cs
- FragmentQueryProcessor.cs
- UnmanagedMemoryStream.cs
- AssociatedControlConverter.cs
- UnmanagedMemoryStreamWrapper.cs
- _ConnectionGroup.cs
- DragEventArgs.cs
- QuaternionKeyFrameCollection.cs
- DataRow.cs
- EntityDataSourceSelectingEventArgs.cs
- ZipIOLocalFileDataDescriptor.cs
- ModuleBuilder.cs
- ControlPaint.cs
- Peer.cs
- WindowsSolidBrush.cs
- ZipIOCentralDirectoryBlock.cs
- CultureInfoConverter.cs
- OrCondition.cs
- ToggleButton.cs
- GlyphTypeface.cs