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
- RecognizeCompletedEventArgs.cs
- RegexCompilationInfo.cs
- InputBinder.cs
- TransactionTable.cs
- DispatcherTimer.cs
- BindValidationContext.cs
- IncomingWebResponseContext.cs
- ModelItemExtensions.cs
- LocalizableResourceBuilder.cs
- WindowsGraphics2.cs
- XmlCharType.cs
- FrameworkElement.cs
- SqlBooleanizer.cs
- DocumentReference.cs
- SessionKeyExpiredException.cs
- RegexCaptureCollection.cs
- SoapSchemaMember.cs
- CompositeKey.cs
- SpeechDetectedEventArgs.cs
- PriorityBindingExpression.cs
- XmlExtensionFunction.cs
- LinqDataSourceContextData.cs
- InputManager.cs
- TraversalRequest.cs
- FileChangeNotifier.cs
- MultilineStringConverter.cs
- RewritingPass.cs
- GB18030Encoding.cs
- ListViewItem.cs
- SqlTopReducer.cs
- DataGridViewRowHeaderCell.cs
- AccessedThroughPropertyAttribute.cs
- ServiceCredentialsSecurityTokenManager.cs
- RangeValueProviderWrapper.cs
- HostedElements.cs
- Misc.cs
- WinInet.cs
- TableItemProviderWrapper.cs
- LicenseException.cs
- XmlNodeReader.cs
- xmlfixedPageInfo.cs
- TargetException.cs
- OleDbFactory.cs
- ConfigurationSectionGroup.cs
- ContainerControlDesigner.cs
- ResourceDescriptionAttribute.cs
- FlowDocumentPage.cs
- QuaternionValueSerializer.cs
- DbConnectionPoolGroupProviderInfo.cs
- Crc32Helper.cs
- HTTPNotFoundHandler.cs
- TypeDelegator.cs
- ToolStripSeparator.cs
- GridViewUpdateEventArgs.cs
- BuildResult.cs
- ErrorFormatter.cs
- SoapInteropTypes.cs
- Rule.cs
- FolderBrowserDialog.cs
- SemaphoreSecurity.cs
- QilGenerator.cs
- DataControlReference.cs
- MergeLocalizationDirectives.cs
- DbProviderServices.cs
- PrintEvent.cs
- NoneExcludedImageIndexConverter.cs
- TextRangeProviderWrapper.cs
- OleAutBinder.cs
- SqlWebEventProvider.cs
- ContentPlaceHolder.cs
- CellTreeSimplifier.cs
- FloatAverageAggregationOperator.cs
- MasterPageBuildProvider.cs
- StrokeRenderer.cs
- DataGridViewRowErrorTextNeededEventArgs.cs
- SrgsDocument.cs
- AnnotationObservableCollection.cs
- ScalarRestriction.cs
- PrimarySelectionGlyph.cs
- VariableExpressionConverter.cs
- HeaderedContentControl.cs
- Window.cs
- Model3DGroup.cs
- FixedPageProcessor.cs
- Part.cs
- WizardDesigner.cs
- ExpressionHelper.cs
- ClusterUtils.cs
- BitmapFrameEncode.cs
- LinearKeyFrames.cs
- StatusBarAutomationPeer.cs
- httpserverutility.cs
- Label.cs
- CompositeFontFamily.cs
- RegexMatchCollection.cs
- SvcFileManager.cs
- DocumentsTrace.cs
- NullableLongSumAggregationOperator.cs
- TableItemPatternIdentifiers.cs
- BooleanExpr.cs