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
- EventManager.cs
- Rotation3DKeyFrameCollection.cs
- DataGridLength.cs
- UserControlCodeDomTreeGenerator.cs
- ClientSettingsStore.cs
- WebPartManagerInternals.cs
- RegistryExceptionHelper.cs
- ToolbarAUtomationPeer.cs
- SqlWebEventProvider.cs
- GridViewRow.cs
- RegexParser.cs
- Relationship.cs
- ColorEditor.cs
- SqlInternalConnectionSmi.cs
- PropertyMetadata.cs
- GuidConverter.cs
- InvalidFilterCriteriaException.cs
- StringArrayConverter.cs
- ItemMap.cs
- ImageListUtils.cs
- CollectionContainer.cs
- WSSecureConversation.cs
- SolidBrush.cs
- HoistedLocals.cs
- ListItemCollection.cs
- ShaderEffect.cs
- SimpleHandlerFactory.cs
- NoResizeSelectionBorderGlyph.cs
- ObjectSet.cs
- DependencyObjectType.cs
- OciLobLocator.cs
- RowToFieldTransformer.cs
- SQLInt32Storage.cs
- XslVisitor.cs
- Propagator.cs
- ObjectDisposedException.cs
- TransformBlockRequest.cs
- PathFigureCollectionConverter.cs
- Control.cs
- MultiAsyncResult.cs
- StyleTypedPropertyAttribute.cs
- AssemblyContextControlItem.cs
- BorderGapMaskConverter.cs
- XPathNode.cs
- StackBuilderSink.cs
- DiscreteKeyFrames.cs
- ASCIIEncoding.cs
- PropertyEmitter.cs
- DiagnosticsConfigurationHandler.cs
- WsdlHelpGeneratorElement.cs
- LockedBorderGlyph.cs
- CodeDelegateInvokeExpression.cs
- TableItemProviderWrapper.cs
- TypeDescriptionProvider.cs
- RegexWorker.cs
- StylusSystemGestureEventArgs.cs
- TdsValueSetter.cs
- BitStream.cs
- CommandBinding.cs
- ColorBlend.cs
- Table.cs
- ConvertBinder.cs
- Positioning.cs
- SwitchDesigner.xaml.cs
- XmlWrappingReader.cs
- ArgIterator.cs
- BindingManagerDataErrorEventArgs.cs
- CompoundFileStorageReference.cs
- BamlWriter.cs
- RegexNode.cs
- PermissionRequestEvidence.cs
- ServiceActivationException.cs
- DataGridCaption.cs
- DrawingContextWalker.cs
- IPEndPoint.cs
- WebPartEditorApplyVerb.cs
- UndoManager.cs
- SqlProfileProvider.cs
- SafeNativeMethodsOther.cs
- ListItemParagraph.cs
- SimpleNameService.cs
- IChannel.cs
- GridSplitterAutomationPeer.cs
- ParameterCollection.cs
- ProcessHostConfigUtils.cs
- PeerToPeerException.cs
- BulletedList.cs
- FacetDescription.cs
- SiteMapProvider.cs
- RealizedColumnsBlock.cs
- ByteAnimation.cs
- SafePipeHandle.cs
- MetadataCollection.cs
- LingerOption.cs
- StatusBarItemAutomationPeer.cs
- CharUnicodeInfo.cs
- PropertySegmentSerializer.cs
- SqlWebEventProvider.cs
- EmptyStringExpandableObjectConverter.cs
- AudioBase.cs