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
- AffineTransform3D.cs
- AttachInfo.cs
- TableLayoutPanelCellPosition.cs
- StrongTypingException.cs
- WebDescriptionAttribute.cs
- TextBox.cs
- HttpStreamMessageEncoderFactory.cs
- UnknownBitmapEncoder.cs
- DodSequenceMerge.cs
- AsyncResult.cs
- XmlSchemaExporter.cs
- SelectionList.cs
- SafeFileMappingHandle.cs
- SystemColorTracker.cs
- TreeView.cs
- FontDifferentiator.cs
- SqlCommand.cs
- XamlSerializerUtil.cs
- _UncName.cs
- baseaxisquery.cs
- FlowDocumentView.cs
- ObjectListItemCollection.cs
- PathFigureCollectionValueSerializer.cs
- SafeCertificateStore.cs
- login.cs
- GridPattern.cs
- KeyValuePair.cs
- SqlDataSourceSelectingEventArgs.cs
- ToolStripDropDown.cs
- HwndSourceParameters.cs
- OleDbTransaction.cs
- DbProviderFactory.cs
- InvariantComparer.cs
- MappingMetadataHelper.cs
- DefaultExpressionVisitor.cs
- EntityWithChangeTrackerStrategy.cs
- TaskFormBase.cs
- PriorityRange.cs
- ButtonFlatAdapter.cs
- PixelFormat.cs
- AddingNewEventArgs.cs
- TextTreeTextNode.cs
- SerializationEventsCache.cs
- GetWinFXPath.cs
- HttpHandlerAction.cs
- DBCommand.cs
- RelationshipSet.cs
- DbSource.cs
- InputProcessorProfilesLoader.cs
- CloudCollection.cs
- ProfileBuildProvider.cs
- ConstantExpression.cs
- SyntaxCheck.cs
- FileDataSourceCache.cs
- UIElementCollection.cs
- BindingCompleteEventArgs.cs
- BinHexDecoder.cs
- DocumentCollection.cs
- odbcmetadatafactory.cs
- BorderGapMaskConverter.cs
- GridViewColumn.cs
- SafeRightsManagementEnvironmentHandle.cs
- querybuilder.cs
- CreateUserWizardAutoFormat.cs
- PropertyStore.cs
- Rect.cs
- HttpChannelBindingToken.cs
- DetailsViewCommandEventArgs.cs
- ReadOnlyNameValueCollection.cs
- CorrelationQueryBehavior.cs
- ViewStateModeByIdAttribute.cs
- RelativeSource.cs
- DefaultTraceListener.cs
- AutomationPatternInfo.cs
- SqlDataAdapter.cs
- UndirectedGraph.cs
- Stylus.cs
- FusionWrap.cs
- FloaterParagraph.cs
- CollectionViewGroupRoot.cs
- TextTreeUndo.cs
- DesignerActionListCollection.cs
- ToolStrip.cs
- WindowPattern.cs
- ConnectionManagementElementCollection.cs
- ResizeGrip.cs
- SpecialTypeDataContract.cs
- DataGridViewColumn.cs
- ScrollBar.cs
- WorkItem.cs
- DoubleLinkListEnumerator.cs
- NewArray.cs
- XslCompiledTransform.cs
- NonVisualControlAttribute.cs
- TransformValueSerializer.cs
- QilScopedVisitor.cs
- MenuAdapter.cs
- GetWinFXPath.cs
- BindingExpressionBase.cs
- ConfigurationUtility.cs