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
- HtmlPanelAdapter.cs
- SqlParameterizer.cs
- TypedDataSourceCodeGenerator.cs
- formatter.cs
- GlyphsSerializer.cs
- AnnotationResource.cs
- TableLayoutStyle.cs
- DictionarySectionHandler.cs
- Int32CollectionValueSerializer.cs
- WindowsAuthenticationEventArgs.cs
- PtsContext.cs
- PropertyGridEditorPart.cs
- EventProviderWriter.cs
- NotifyParentPropertyAttribute.cs
- Size3D.cs
- AssemblyBuilder.cs
- OptimizerPatterns.cs
- RelatedView.cs
- ListViewCommandEventArgs.cs
- GeneralTransform2DTo3DTo2D.cs
- EditCommandColumn.cs
- ClientUrlResolverWrapper.cs
- AppSettingsExpressionEditor.cs
- Page.cs
- ReferenceAssemblyAttribute.cs
- DynamicDataRouteHandler.cs
- KeyValuePairs.cs
- CaretElement.cs
- ShutDownListener.cs
- AssemblyInfo.cs
- TextContainerHelper.cs
- DefaultBindingPropertyAttribute.cs
- ParsedAttributeCollection.cs
- ActivityMarkupSerializer.cs
- TextTreeRootNode.cs
- AnnotationAdorner.cs
- XmlSerializerFactory.cs
- AnnotationStore.cs
- WebServiceFaultDesigner.cs
- XmlDataSourceNodeDescriptor.cs
- SqlFunctionAttribute.cs
- SoapFaultCodes.cs
- DesignerSerializationOptionsAttribute.cs
- DictionaryBase.cs
- SqlFacetAttribute.cs
- WindowsContainer.cs
- BrushConverter.cs
- ScriptResourceHandler.cs
- AnnouncementService.cs
- WorkflowRuntimeServiceElement.cs
- ClientFormsAuthenticationCredentials.cs
- IIS7WorkerRequest.cs
- SupportedAddressingMode.cs
- SizeConverter.cs
- Msmq3PoisonHandler.cs
- _SecureChannel.cs
- HtmlValidationSummaryAdapter.cs
- TagPrefixInfo.cs
- CombinedHttpChannel.cs
- ConfigPathUtility.cs
- BrowserInteropHelper.cs
- RSACryptoServiceProvider.cs
- DataRelation.cs
- HandleRef.cs
- sapiproxy.cs
- TextDocumentView.cs
- ListViewContainer.cs
- UniformGrid.cs
- AffineTransform3D.cs
- Pens.cs
- HttpHandlerActionCollection.cs
- AttributeConverter.cs
- StylusCaptureWithinProperty.cs
- ResourcesGenerator.cs
- CompensationTokenData.cs
- TypeResolvingOptionsAttribute.cs
- AlphaSortedEnumConverter.cs
- RSAPKCS1SignatureDeformatter.cs
- KeyPullup.cs
- CodeDomComponentSerializationService.cs
- ConstructorBuilder.cs
- GlyphsSerializer.cs
- SchemaObjectWriter.cs
- AppDomainAttributes.cs
- CommunicationException.cs
- TitleStyle.cs
- AssemblyHash.cs
- DocumentAutomationPeer.cs
- ClassGenerator.cs
- FontStretchConverter.cs
- TextEffectResolver.cs
- ObjectDataSource.cs
- PolicyManager.cs
- TablePatternIdentifiers.cs
- RectangleF.cs
- CredentialCache.cs
- ZipFileInfo.cs
- ImageSourceTypeConverter.cs
- MappedMetaModel.cs
- XamlFigureLengthSerializer.cs