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
- LightweightCodeGenerator.cs
- StreamReader.cs
- Helper.cs
- XmlAttributes.cs
- SmiEventSink.cs
- Token.cs
- PathStreamGeometryContext.cs
- EmptyStringExpandableObjectConverter.cs
- NamespaceCollection.cs
- TdsParser.cs
- ParserStack.cs
- CollectionViewGroup.cs
- XmlAttributeCollection.cs
- CollectionsUtil.cs
- LinkLabel.cs
- ListViewTableRow.cs
- HttpListenerTimeoutManager.cs
- SecurityState.cs
- DataKey.cs
- ClientRuntime.cs
- DataGridViewTopLeftHeaderCell.cs
- ExpressionEvaluator.cs
- FontWeightConverter.cs
- JapaneseLunisolarCalendar.cs
- DataListItemEventArgs.cs
- HttpCookie.cs
- HttpRequestCacheValidator.cs
- PenThreadWorker.cs
- AttachedPropertyBrowsableForChildrenAttribute.cs
- HostingEnvironmentException.cs
- ImpersonationContext.cs
- ProtocolsSection.cs
- AuthenticationServiceManager.cs
- DBParameter.cs
- OdbcErrorCollection.cs
- FastEncoderWindow.cs
- PageRanges.cs
- SqlAliasesReferenced.cs
- BatchWriter.cs
- ProcessModuleCollection.cs
- MenuScrollingVisibilityConverter.cs
- ResourcePool.cs
- AnchoredBlock.cs
- safePerfProviderHandle.cs
- ObjectStateEntry.cs
- ItemsControl.cs
- SizeAnimationBase.cs
- SafeThemeHandle.cs
- SortedDictionary.cs
- ImageDrawing.cs
- HttpApplication.cs
- AccessDataSource.cs
- InlineUIContainer.cs
- DataListCommandEventArgs.cs
- StatusBarAutomationPeer.cs
- WebPartMenuStyle.cs
- PrintDocument.cs
- CompositeKey.cs
- Hex.cs
- AvTraceFormat.cs
- CultureInfo.cs
- SystemIdentity.cs
- Mouse.cs
- ListSortDescriptionCollection.cs
- XmlExpressionDumper.cs
- TextSpanModifier.cs
- InkCanvasSelectionAdorner.cs
- TopClause.cs
- BinaryConverter.cs
- grammarelement.cs
- StandardCommands.cs
- NativeMethods.cs
- GZipDecoder.cs
- ListViewItem.cs
- GeometryHitTestResult.cs
- BeginStoryboard.cs
- OleDbMetaDataFactory.cs
- VideoDrawing.cs
- Int32Collection.cs
- ImageCodecInfo.cs
- GACMembershipCondition.cs
- CacheAxisQuery.cs
- ContentWrapperAttribute.cs
- TableLayoutCellPaintEventArgs.cs
- Sequence.cs
- PropVariant.cs
- CTreeGenerator.cs
- AddressingProperty.cs
- InterleavedZipPartStream.cs
- DropDownList.cs
- ShaderEffect.cs
- QueryOutputWriter.cs
- SqlClientMetaDataCollectionNames.cs
- QuaternionAnimationBase.cs
- MailHeaderInfo.cs
- Rotation3D.cs
- CodeTypeReferenceCollection.cs
- MeasureItemEvent.cs
- FragmentQueryKB.cs
- ValidationEventArgs.cs