Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / Services / Monitoring / system / Diagnosticts / Design / CounterCreationDataConverter.cs / 1 / CounterCreationDataConverter.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Diagnostics.Design { using System.Runtime.Serialization.Formatters; using System.Diagnostics; using System; using System.ComponentModel; using System.ComponentModel.Design.Serialization; using System.Globalization; using System.Reflection; internal class CounterCreationDataConverter : ExpandableObjectConverter { ////// /// public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) { if (destinationType == typeof(InstanceDescriptor)) { return true; } return base.CanConvertTo(context, destinationType); } ///Gets a value indicating whether this converter can /// convert an object to the given destination type using the context. ////// /// Converts the given object to another type. The most common types to convert /// are to and from a string object. The default implementation will make a call /// to ToString on the object if the object is valid and if the destination /// type is string. If this cannot convert to the desitnation type, this will /// throw a NotSupportedException. /// public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { if (destinationType == null) { throw new ArgumentNullException("destinationType"); } if (destinationType == typeof(InstanceDescriptor) && value is CounterCreationData) { CounterCreationData data = (CounterCreationData)value; ConstructorInfo ctor = typeof(CounterCreationData).GetConstructor(new Type[] { typeof(string), typeof(string), typeof(PerformanceCounterType)}); if (ctor != null) { return new InstanceDescriptor(ctor, new object[] { data.CounterName, data.CounterHelp, data.CounterType}); } } return base.ConvertTo(context, culture, value, destinationType); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- _ChunkParse.cs
- ApplicationDirectory.cs
- IFlowDocumentViewer.cs
- DataGridViewComboBoxEditingControl.cs
- WebBrowserBase.cs
- WindowsTitleBar.cs
- ReadOnlyNameValueCollection.cs
- WebPartsSection.cs
- HashHelper.cs
- NativeCppClassAttribute.cs
- LocatorPartList.cs
- ColorMap.cs
- PartialList.cs
- Grant.cs
- ConnectionString.cs
- FrameworkTemplate.cs
- StateMachineWorkflow.cs
- IisTraceListener.cs
- ProfileServiceManager.cs
- XmlReaderSettings.cs
- RegexGroup.cs
- ReachDocumentSequenceSerializerAsync.cs
- ActivityExecutionContextCollection.cs
- ErrorHandler.cs
- Material.cs
- FolderBrowserDialog.cs
- ResolveResponse.cs
- DataBindEngine.cs
- ProcessModule.cs
- LicenseException.cs
- AlgoModule.cs
- VectorCollectionConverter.cs
- EntityClassGenerator.cs
- InvalidWMPVersionException.cs
- MemoryPressure.cs
- DoubleLink.cs
- objectresult_tresulttype.cs
- ValidatedControlConverter.cs
- TableLayoutSettingsTypeConverter.cs
- WebRequestModuleElement.cs
- Typeface.cs
- ServiceModelConfigurationSection.cs
- BrowserInteropHelper.cs
- ControlParameter.cs
- RowVisual.cs
- XmlMembersMapping.cs
- TransactionScopeDesigner.cs
- BinHexEncoder.cs
- AppDomainFactory.cs
- DynamicValidatorEventArgs.cs
- WebBrowser.cs
- VisualProxy.cs
- TraceHwndHost.cs
- WindowShowOrOpenTracker.cs
- ImageMap.cs
- MemoryPressure.cs
- ReliableChannelFactory.cs
- RowSpanVector.cs
- SuppressIldasmAttribute.cs
- TransformerTypeCollection.cs
- Timer.cs
- AssociationSetEnd.cs
- SharedPersonalizationStateInfo.cs
- XmlChoiceIdentifierAttribute.cs
- ZipFileInfo.cs
- HttpValueCollection.cs
- SingleAnimationBase.cs
- CapabilitiesUse.cs
- SqlDataSourceStatusEventArgs.cs
- CodeGenerator.cs
- MessageRpc.cs
- SQLGuidStorage.cs
- HashLookup.cs
- MailMessage.cs
- Filter.cs
- MultipartIdentifier.cs
- ServiceNotStartedException.cs
- CryptoProvider.cs
- KeyProperty.cs
- DataGridViewRowHeaderCell.cs
- HttpDebugHandler.cs
- StylusDevice.cs
- LinqDataSource.cs
- NumericUpDownAccelerationCollection.cs
- Token.cs
- PassportAuthentication.cs
- UpdateCompiler.cs
- ManipulationDevice.cs
- TriState.cs
- CodeChecksumPragma.cs
- AuthenticationSection.cs
- QilName.cs
- IRCollection.cs
- UnsafeNativeMethods.cs
- TransformGroup.cs
- StringKeyFrameCollection.cs
- DataColumnPropertyDescriptor.cs
- Funcletizer.cs
- EventLogQuery.cs
- ZoneLinkButton.cs