Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Core / System / Diagnostics / Eventing / Reader / EventKeyword.cs / 1305376 / EventKeyword.cs
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== /*============================================================ ** ** Class: EventKeyword ** ** Purpose: ** This public class describes the metadata for a specific Keyword ** 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 Keyword defined by a Provider. /// An instance of this class is obtained from a ProviderMetadata object. /// [System.Security.Permissions.HostProtection(MayLeakOnAbort = true)] public sealed class EventKeyword { private long value; private string name; private string displayName; private bool dataReady; ProviderMetadata pmReference; object syncObject; //called from EventMetadata internal EventKeyword(long value, ProviderMetadata pmReference) { this.value = value; this.pmReference = pmReference; this.syncObject = new object(); } //called from ProviderMetadata internal EventKeyword(string name, long 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.Keywords; this.name = null; this.displayName = null; this.dataReady = true; foreach (EventKeyword key in result) { if (key.Value == this.value) { this.name = key.Name; this.displayName = key.DisplayName; break; } } } } public string Name { get { PrepareData(); return this.name; } } public long 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: EventKeyword ** ** Purpose: ** This public class describes the metadata for a specific Keyword ** 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 Keyword defined by a Provider. /// An instance of this class is obtained from a ProviderMetadata object. /// [System.Security.Permissions.HostProtection(MayLeakOnAbort = true)] public sealed class EventKeyword { private long value; private string name; private string displayName; private bool dataReady; ProviderMetadata pmReference; object syncObject; //called from EventMetadata internal EventKeyword(long value, ProviderMetadata pmReference) { this.value = value; this.pmReference = pmReference; this.syncObject = new object(); } //called from ProviderMetadata internal EventKeyword(string name, long 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.Keywords; this.name = null; this.displayName = null; this.dataReady = true; foreach (EventKeyword key in result) { if (key.Value == this.value) { this.name = key.Name; this.displayName = key.DisplayName; break; } } } } public string Name { get { PrepareData(); return this.name; } } public long 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
- EditorPartChrome.cs
- NotSupportedException.cs
- HTTPRemotingHandler.cs
- StringConverter.cs
- RangeContentEnumerator.cs
- FileInfo.cs
- SamlAction.cs
- Predicate.cs
- DeadCharTextComposition.cs
- ILGen.cs
- InfiniteIntConverter.cs
- EdmToObjectNamespaceMap.cs
- MembershipValidatePasswordEventArgs.cs
- ConnectionStringEditor.cs
- ApplyTemplatesAction.cs
- Int16Converter.cs
- UmAlQuraCalendar.cs
- _HeaderInfo.cs
- MsmqBindingElementBase.cs
- GrammarBuilderWildcard.cs
- DataTemplateSelector.cs
- CodeAttributeArgumentCollection.cs
- ImportContext.cs
- WindowsComboBox.cs
- SrgsToken.cs
- TextBlock.cs
- QueryOptionExpression.cs
- XPathParser.cs
- SmiContextFactory.cs
- _TLSstream.cs
- FontFamily.cs
- OraclePermissionAttribute.cs
- AssemblyBuilder.cs
- GridErrorDlg.cs
- _ReceiveMessageOverlappedAsyncResult.cs
- TextProperties.cs
- IsolatedStoragePermission.cs
- CompleteWizardStep.cs
- EntitySetRetriever.cs
- CloseSequence.cs
- DiagnosticTraceSchemas.cs
- JoinTreeNode.cs
- EventsTab.cs
- TextBoxView.cs
- JavaScriptString.cs
- TypedAsyncResult.cs
- Compilation.cs
- PolyQuadraticBezierSegment.cs
- FastPropertyAccessor.cs
- BaseTemplateParser.cs
- Vector3DKeyFrameCollection.cs
- FormViewModeEventArgs.cs
- SourceElementsCollection.cs
- TypeReference.cs
- Synchronization.cs
- TextEditorSpelling.cs
- DesignerDataParameter.cs
- CompModHelpers.cs
- OdbcUtils.cs
- SettingsAttributes.cs
- PanningMessageFilter.cs
- Journaling.cs
- Graphics.cs
- ConstructorNeedsTagAttribute.cs
- Operators.cs
- Pointer.cs
- QilInvokeEarlyBound.cs
- BinaryObjectInfo.cs
- ReadOnlyNameValueCollection.cs
- DataGridViewRowEventArgs.cs
- CalendarDay.cs
- CheckableControlBaseAdapter.cs
- OdbcDataAdapter.cs
- PolicyValidationException.cs
- ErasingStroke.cs
- SecurityTokenResolver.cs
- XmlValidatingReaderImpl.cs
- Instrumentation.cs
- CssTextWriter.cs
- OdbcDataAdapter.cs
- WebPartDeleteVerb.cs
- ViewStateException.cs
- DataSvcMapFileSerializer.cs
- SystemUdpStatistics.cs
- ObservableCollection.cs
- DataGridViewCellCancelEventArgs.cs
- RijndaelManaged.cs
- DynamicMetaObjectBinder.cs
- SafeArrayTypeMismatchException.cs
- CalendarButton.cs
- ProtectedConfiguration.cs
- Exceptions.cs
- WindowsStatusBar.cs
- SendActivity.cs
- FtpWebResponse.cs
- BaseCodePageEncoding.cs
- CriticalFinalizerObject.cs
- XmlNullResolver.cs
- DataSet.cs
- TemplateControlBuildProvider.cs