Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / WinForms / Managed / System / WinForms / DataGridViewRowConverter.cs / 1305376 / DataGridViewRowConverter.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- /* */ namespace System.Windows.Forms { using System.Runtime.Serialization.Formatters; using System.Runtime.Remoting; using System.Runtime.InteropServices; using Microsoft.Win32; using System.Collections; using System.ComponentModel; using System.ComponentModel.Design.Serialization; using System.Drawing; using System.Diagnostics; using System.Globalization; using System.Reflection; internal class DataGridViewRowConverter : ExpandableObjectConverter { public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) { if (destinationType == typeof(InstanceDescriptor)) { return true; } return base.CanConvertTo(context, destinationType); } ////// 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"); } DataGridViewRow dataGridViewRow = value as DataGridViewRow; if (destinationType == typeof(InstanceDescriptor) && dataGridViewRow != null) { // public DataGridViewRow() // ConstructorInfo ctor = dataGridViewRow.GetType().GetConstructor(new Type[0]); if (ctor != null) { return new InstanceDescriptor(ctor, new object[0], false); } } 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. // //----------------------------------------------------------------------------- /* */ namespace System.Windows.Forms { using System.Runtime.Serialization.Formatters; using System.Runtime.Remoting; using System.Runtime.InteropServices; using Microsoft.Win32; using System.Collections; using System.ComponentModel; using System.ComponentModel.Design.Serialization; using System.Drawing; using System.Diagnostics; using System.Globalization; using System.Reflection; internal class DataGridViewRowConverter : ExpandableObjectConverter { public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) { if (destinationType == typeof(InstanceDescriptor)) { return true; } return base.CanConvertTo(context, destinationType); } ////// 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"); } DataGridViewRow dataGridViewRow = value as DataGridViewRow; if (destinationType == typeof(InstanceDescriptor) && dataGridViewRow != null) { // public DataGridViewRow() // ConstructorInfo ctor = dataGridViewRow.GetType().GetConstructor(new Type[0]); if (ctor != null) { return new InstanceDescriptor(ctor, new object[0], false); } } return base.ConvertTo(context, culture, value, destinationType); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- Figure.cs
- WsiProfilesElementCollection.cs
- TransformationRules.cs
- XhtmlBasicValidatorAdapter.cs
- PageAdapter.cs
- EmptyCollection.cs
- EnvelopedSignatureTransform.cs
- CultureInfoConverter.cs
- SymmetricAlgorithm.cs
- XPathBinder.cs
- CallTemplateAction.cs
- BitmapDecoder.cs
- ActivityScheduledQuery.cs
- SoapSchemaExporter.cs
- ConnectionPoolManager.cs
- NativeMethods.cs
- RadioButton.cs
- Base64WriteStateInfo.cs
- ArraySegment.cs
- MailWebEventProvider.cs
- GPRECTF.cs
- AlternateViewCollection.cs
- HtmlInputReset.cs
- LocatorPart.cs
- AppDomain.cs
- ColorConverter.cs
- ObjectSecurity.cs
- WindowsContainer.cs
- CompiledQueryCacheKey.cs
- PathTooLongException.cs
- TextElementCollectionHelper.cs
- ServiceInfo.cs
- SemanticResolver.cs
- WinEventWrap.cs
- LongValidator.cs
- SafePipeHandle.cs
- ParseHttpDate.cs
- PropertyChangedEventManager.cs
- ScalarConstant.cs
- HashHelper.cs
- BufferedResponseStream.cs
- StringConverter.cs
- SignedPkcs7.cs
- Operand.cs
- Monitor.cs
- SpecularMaterial.cs
- PropertyEmitterBase.cs
- PathBox.cs
- SiteMapProvider.cs
- ServiceX509SecurityTokenProvider.cs
- Attributes.cs
- CrossAppDomainChannel.cs
- WorkflowFileItem.cs
- HierarchicalDataSourceIDConverter.cs
- OracleSqlParser.cs
- XmlDeclaration.cs
- ValueTable.cs
- AsnEncodedData.cs
- HwndAppCommandInputProvider.cs
- SupportsEventValidationAttribute.cs
- GenericPrincipal.cs
- PolicyImporterElementCollection.cs
- HybridDictionary.cs
- DomNameTable.cs
- Queue.cs
- ClientSettingsStore.cs
- DiscardableAttribute.cs
- WebPartConnectionsEventArgs.cs
- DesignerToolboxInfo.cs
- RepeaterItemCollection.cs
- SoundPlayerAction.cs
- XamlInt32CollectionSerializer.cs
- ConfigurationHelpers.cs
- LineInfo.cs
- XmlEncoding.cs
- EditorPartCollection.cs
- FederatedMessageSecurityOverHttpElement.cs
- BinarySerializer.cs
- TabControlEvent.cs
- StorageEntitySetMapping.cs
- DependencyPropertyDescriptor.cs
- _SslStream.cs
- DataGridClipboardHelper.cs
- PolyLineSegmentFigureLogic.cs
- StrokeNodeOperations.cs
- AdapterDictionary.cs
- XmlSchemaImporter.cs
- DynamicEndpoint.cs
- TraceContextEventArgs.cs
- DrawingContextDrawingContextWalker.cs
- TimersDescriptionAttribute.cs
- InplaceBitmapMetadataWriter.cs
- IDReferencePropertyAttribute.cs
- RSACryptoServiceProvider.cs
- SortQuery.cs
- EnglishPluralizationService.cs
- EnvelopedSignatureTransform.cs
- X509CertificateCollection.cs
- ProtocolsConfigurationHandler.cs
- XmlWriterSettings.cs