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
- _AutoWebProxyScriptHelper.cs
- AssemblyInfo.cs
- NativeWindow.cs
- KeyConverter.cs
- TextMarkerSource.cs
- OwnerDrawPropertyBag.cs
- DesignerPainter.cs
- PeerNameRecord.cs
- ChangeNode.cs
- URL.cs
- ProtocolImporter.cs
- ButtonField.cs
- GridItemCollection.cs
- UnsafeNetInfoNativeMethods.cs
- AppDomainProtocolHandler.cs
- Documentation.cs
- FileEnumerator.cs
- TickBar.cs
- ConstantSlot.cs
- ApplicationFileCodeDomTreeGenerator.cs
- DataGridViewDesigner.cs
- SimplePropertyEntry.cs
- DocumentApplicationJournalEntry.cs
- ScriptManager.cs
- CodeBlockBuilder.cs
- GPRECT.cs
- XPathSelfQuery.cs
- DateTimeSerializationSection.cs
- StructuredTypeInfo.cs
- DataQuery.cs
- MetadataPropertyvalue.cs
- InvokeCompletedEventArgs.cs
- ContextMenuService.cs
- ViewDesigner.cs
- DrawingContext.cs
- RtfToXamlReader.cs
- LockedActivityGlyph.cs
- PriorityQueue.cs
- UserPreferenceChangedEventArgs.cs
- ConfigurationException.cs
- Font.cs
- IPHostEntry.cs
- GroupByQueryOperator.cs
- FormatterConverter.cs
- ClientSettings.cs
- MultiBindingExpression.cs
- MarshalDirectiveException.cs
- DataGridViewRowContextMenuStripNeededEventArgs.cs
- UndoEngine.cs
- ContextMenuStripGroupCollection.cs
- BasicExpressionVisitor.cs
- GeometryModel3D.cs
- MustUnderstandBehavior.cs
- CommonXSendMessage.cs
- RouteParametersHelper.cs
- TransformPatternIdentifiers.cs
- Ref.cs
- GeometryConverter.cs
- tooltip.cs
- codemethodreferenceexpression.cs
- FormParameter.cs
- Stack.cs
- GlobalItem.cs
- TaskFileService.cs
- FlowDocumentFormatter.cs
- IndexedGlyphRun.cs
- PropertyFilterAttribute.cs
- ProfilePropertyMetadata.cs
- ObjectParameterCollection.cs
- EncodingNLS.cs
- ProofTokenCryptoHandle.cs
- RegexParser.cs
- ColorConvertedBitmapExtension.cs
- ControlCodeDomSerializer.cs
- PartManifestEntry.cs
- StaticTextPointer.cs
- CodeTypeMember.cs
- RC2.cs
- UiaCoreProviderApi.cs
- StateValidator.cs
- DeobfuscatingStream.cs
- addressfiltermode.cs
- UserInitiatedNavigationPermission.cs
- AsymmetricAlgorithm.cs
- XamlSerializerUtil.cs
- DataGridViewButtonCell.cs
- ContextMenuAutomationPeer.cs
- FieldMetadata.cs
- EntityExpressionVisitor.cs
- securitycriticaldata.cs
- DesignerOptionService.cs
- OperatingSystem.cs
- TimeStampChecker.cs
- DiscoveryDocumentSerializer.cs
- OdbcErrorCollection.cs
- CmsInterop.cs
- TypeBrowserDialog.cs
- XsltInput.cs
- Vector3D.cs
- SmiRequestExecutor.cs