Code:
/ DotNET / DotNET / 8.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
- TypeListConverter.cs
- DataTableReaderListener.cs
- AsyncMethodInvoker.cs
- SqlFunctionAttribute.cs
- WeakEventManager.cs
- Image.cs
- GridViewAutomationPeer.cs
- HandoffBehavior.cs
- Html32TextWriter.cs
- FieldBuilder.cs
- InkCanvasSelectionAdorner.cs
- LinkedResourceCollection.cs
- SocketAddress.cs
- ConvertTextFrag.cs
- ProcessModelInfo.cs
- UndoEngine.cs
- TemplateBamlRecordReader.cs
- AutomationPattern.cs
- CodeFieldReferenceExpression.cs
- DnsEndpointIdentity.cs
- RadioButton.cs
- FacetValueContainer.cs
- WindowsProgressbar.cs
- DataGridViewCellStyleBuilderDialog.cs
- RestHandler.cs
- InputLangChangeRequestEvent.cs
- BitConverter.cs
- TypeSystem.cs
- DisableDpiAwarenessAttribute.cs
- LineServicesRun.cs
- XmlChildNodes.cs
- EntityClientCacheKey.cs
- MediaSystem.cs
- GenerateHelper.cs
- CodeNamespaceCollection.cs
- MemberJoinTreeNode.cs
- WriterOutput.cs
- FormsAuthenticationTicket.cs
- COAUTHIDENTITY.cs
- FormsAuthenticationConfiguration.cs
- ExpandCollapsePattern.cs
- OpenTypeLayout.cs
- BaseParaClient.cs
- StringFormat.cs
- CodeArrayCreateExpression.cs
- CallbackValidator.cs
- AsyncOperationLifetimeManager.cs
- IList.cs
- MenuRendererStandards.cs
- AppDomainUnloadedException.cs
- ConditionCollection.cs
- MetadataProperty.cs
- SEHException.cs
- ModuleBuilder.cs
- XsdBuilder.cs
- XsltException.cs
- ViewStateModeByIdAttribute.cs
- CDSCollectionETWBCLProvider.cs
- PreviewPrintController.cs
- EntityContainerRelationshipSetEnd.cs
- _Events.cs
- BuilderPropertyEntry.cs
- ConsumerConnectionPointCollection.cs
- hwndwrapper.cs
- GroupBox.cs
- SchemaType.cs
- ObjectTokenCategory.cs
- TextDpi.cs
- JournalEntry.cs
- HttpListenerResponse.cs
- FixedTextSelectionProcessor.cs
- Number.cs
- BufferedGraphicsManager.cs
- ListControlStringCollectionEditor.cs
- Permission.cs
- Attachment.cs
- HtmlInputHidden.cs
- MinMaxParagraphWidth.cs
- InplaceBitmapMetadataWriter.cs
- DataGridCellsPresenter.cs
- ExceptionTrace.cs
- APCustomTypeDescriptor.cs
- Missing.cs
- PresentationTraceSources.cs
- MergeFilterQuery.cs
- ReachDocumentPageSerializerAsync.cs
- PreviewPageInfo.cs
- GZipDecoder.cs
- WebPartVerbCollection.cs
- WindowsStatic.cs
- UpdateRecord.cs
- BookmarkEventArgs.cs
- StringHandle.cs
- NativeRightsManagementAPIsStructures.cs
- EntityContainer.cs
- ArgIterator.cs
- DoWorkEventArgs.cs
- ElementHostAutomationPeer.cs
- ProxyHelper.cs
- XmlSchemaImport.cs