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
- PolicyUnit.cs
- MultiPropertyDescriptorGridEntry.cs
- LineProperties.cs
- SmtpDigestAuthenticationModule.cs
- TableLayoutPanel.cs
- BasicExpressionVisitor.cs
- PersistNameAttribute.cs
- hresults.cs
- Wildcard.cs
- GregorianCalendar.cs
- ProcessHostMapPath.cs
- ConfigDefinitionUpdates.cs
- TranslateTransform3D.cs
- SplayTreeNode.cs
- UInt32Converter.cs
- Single.cs
- _DisconnectOverlappedAsyncResult.cs
- SqlReferenceCollection.cs
- DetailsViewDeletedEventArgs.cs
- ProtocolsConfigurationHandler.cs
- ResourceDescriptionAttribute.cs
- NavigationWindow.cs
- DesignTimeResourceProviderFactoryAttribute.cs
- ByteStack.cs
- XmlLoader.cs
- ProxyHwnd.cs
- Socket.cs
- EncoderNLS.cs
- HttpListenerContext.cs
- ExpressionsCollectionEditor.cs
- MessageQueuePermissionEntry.cs
- TypeConverterHelper.cs
- GeometryModel3D.cs
- RSAPKCS1SignatureFormatter.cs
- Select.cs
- UxThemeWrapper.cs
- MultiByteCodec.cs
- WSIdentityFaultException.cs
- ToolboxComponentsCreatedEventArgs.cs
- SafeViewOfFileHandle.cs
- IdentityElement.cs
- Trigger.cs
- AutomationElementIdentifiers.cs
- ResourceSet.cs
- XmlSchemaInferenceException.cs
- TextRangeEdit.cs
- BasicExpressionVisitor.cs
- TriggerAction.cs
- WebUtil.cs
- MutexSecurity.cs
- MsmqVerifier.cs
- MetabaseServerConfig.cs
- AttributeQuery.cs
- OuterGlowBitmapEffect.cs
- DesignerPerfEventProvider.cs
- SizeChangedInfo.cs
- xml.cs
- log.cs
- TargetException.cs
- Globals.cs
- TargetFrameworkUtil.cs
- TcpHostedTransportConfiguration.cs
- ButtonColumn.cs
- PerformanceCounterPermissionEntry.cs
- AQNBuilder.cs
- XPathAncestorQuery.cs
- _FtpDataStream.cs
- RayMeshGeometry3DHitTestResult.cs
- FormCollection.cs
- ChtmlPhoneCallAdapter.cs
- OleDbInfoMessageEvent.cs
- SubqueryRules.cs
- ControlCollection.cs
- HMACMD5.cs
- DataGridColumn.cs
- CodeAccessSecurityEngine.cs
- COM2ComponentEditor.cs
- FormatStringEditor.cs
- WebPartConnectionsCancelVerb.cs
- DefaultWorkflowTransactionService.cs
- ButtonFlatAdapter.cs
- EntityReference.cs
- SchemaImporterExtensionsSection.cs
- DoubleAnimationUsingPath.cs
- CodeLinePragma.cs
- FontStretch.cs
- DefaultPropertyAttribute.cs
- BeginSelectCardRequest.cs
- TransformValueSerializer.cs
- UnsettableComboBox.cs
- VirtualDirectoryMappingCollection.cs
- Internal.cs
- ContentIterators.cs
- AnimationLayer.cs
- ListViewGroupConverter.cs
- ProgressBarRenderer.cs
- AppDomainResourcePerfCounters.cs
- XmlBinaryReader.cs
- SchemaConstraints.cs
- ScriptingWebServicesSectionGroup.cs