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
- ListControlConvertEventArgs.cs
- ChangeProcessor.cs
- ModifierKeysConverter.cs
- RegisteredExpandoAttribute.cs
- DataServiceHost.cs
- TreeViewAutomationPeer.cs
- MenuItemBindingCollection.cs
- XpsImage.cs
- SoapCodeExporter.cs
- KnownTypesHelper.cs
- ServicesUtilities.cs
- SkewTransform.cs
- WhitespaceRuleLookup.cs
- StrongNameMembershipCondition.cs
- Vector3DAnimationBase.cs
- StrokeSerializer.cs
- LinkedDataMemberFieldEditor.cs
- HMACSHA512.cs
- LockCookie.cs
- WeakReadOnlyCollection.cs
- TextSearch.cs
- FileStream.cs
- DocumentGridContextMenu.cs
- DataSourceSelectArguments.cs
- DesignerForm.cs
- AbandonedMutexException.cs
- ResourceDictionaryCollection.cs
- GlyphElement.cs
- HtmlGenericControl.cs
- CustomError.cs
- PolyBezierSegment.cs
- CommandConverter.cs
- HandlerWithFactory.cs
- SecurityTokenSerializer.cs
- ListDataBindEventArgs.cs
- CodeMethodMap.cs
- RangeValueProviderWrapper.cs
- PropertyChangeTracker.cs
- RegistrySecurity.cs
- UnionCqlBlock.cs
- LambdaReference.cs
- PackageFilter.cs
- XmlSchemaAnyAttribute.cs
- TemplateInstanceAttribute.cs
- QilXmlWriter.cs
- RequestCacheValidator.cs
- TypeValidationEventArgs.cs
- TextOnlyOutput.cs
- RegionIterator.cs
- StringReader.cs
- OracleBFile.cs
- Pens.cs
- DropSource.cs
- WebRequestModuleElement.cs
- PermissionRequestEvidence.cs
- QueryReaderSettings.cs
- HttpModulesInstallComponent.cs
- XmlTextEncoder.cs
- StringTraceRecord.cs
- BulletDecorator.cs
- PageTheme.cs
- EntityWrapper.cs
- TextTabProperties.cs
- PocoEntityKeyStrategy.cs
- ResourceCategoryAttribute.cs
- RegexReplacement.cs
- RolePrincipal.cs
- HttpContextServiceHost.cs
- SecurityUtils.cs
- MutexSecurity.cs
- SoapInteropTypes.cs
- GotoExpression.cs
- PropertyChangeTracker.cs
- AppSettingsSection.cs
- XmlNamespaceDeclarationsAttribute.cs
- XmlEncodedRawTextWriter.cs
- DataGridViewCheckBoxColumn.cs
- ConfigurationHandlersInstallComponent.cs
- LayoutEvent.cs
- ReaderWriterLockWrapper.cs
- AutoCompleteStringCollection.cs
- GB18030Encoding.cs
- EventProviderWriter.cs
- ResourceExpressionBuilder.cs
- WebBaseEventKeyComparer.cs
- _ConnectOverlappedAsyncResult.cs
- NamespaceCollection.cs
- PixelFormats.cs
- GridViewColumnCollectionChangedEventArgs.cs
- Span.cs
- Thickness.cs
- TagPrefixAttribute.cs
- ControlEvent.cs
- Win32SafeHandles.cs
- StylusButtonCollection.cs
- ConnectionManagementSection.cs
- DefaultAssemblyResolver.cs
- PropertyChangeTracker.cs
- Screen.cs
- CodeRegionDirective.cs