Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / fx / src / WinForms / Managed / System / WinForms / DataGridViewRowConverter.cs / 1 / 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
- SimpleLine.cs
- InputBindingCollection.cs
- WebPartZone.cs
- Label.cs
- ManipulationVelocities.cs
- FileCodeGroup.cs
- XamlPoint3DCollectionSerializer.cs
- XPathSingletonIterator.cs
- ReleaseInstanceMode.cs
- CodeTypeMemberCollection.cs
- SystemThemeKey.cs
- CryptoKeySecurity.cs
- WebServiceEnumData.cs
- PlatformCulture.cs
- SymbolMethod.cs
- CollectionTypeElement.cs
- Group.cs
- XmlTextWriter.cs
- AxisAngleRotation3D.cs
- SystemColors.cs
- CompatibleComparer.cs
- Avt.cs
- HttpCookie.cs
- FontSourceCollection.cs
- NavigatorInvalidBodyAccessException.cs
- XmlIncludeAttribute.cs
- HyperLink.cs
- HandlerBase.cs
- InstanceNotFoundException.cs
- COM2IProvidePropertyBuilderHandler.cs
- SamlAuthorizationDecisionClaimResource.cs
- RuleSettingsCollection.cs
- Model3D.cs
- NamespaceImport.cs
- ImageButton.cs
- Padding.cs
- HttpGetProtocolImporter.cs
- InvalidOleVariantTypeException.cs
- GrowingArray.cs
- QueueProcessor.cs
- EventLogPermissionAttribute.cs
- AttributeQuery.cs
- ListViewItemSelectionChangedEvent.cs
- NativeMethods.cs
- SessionState.cs
- SelectedCellsCollection.cs
- COM2Enum.cs
- X509CertificateStore.cs
- TdsParser.cs
- SqlClientWrapperSmiStream.cs
- Effect.cs
- AdjustableArrowCap.cs
- GlobalizationSection.cs
- TableLayoutColumnStyleCollection.cs
- MessageBox.cs
- Executor.cs
- UnaryQueryOperator.cs
- activationcontext.cs
- ReflectionServiceProvider.cs
- XmlAttribute.cs
- DbSetClause.cs
- SqlCacheDependencyDatabaseCollection.cs
- DesignerAttribute.cs
- MethodBuilder.cs
- PathSegmentCollection.cs
- XmlSchemaRedefine.cs
- TargetParameterCountException.cs
- _NegotiateClient.cs
- EntityProviderFactory.cs
- __ComObject.cs
- TextBox.cs
- TypeToken.cs
- PropertyDescriptor.cs
- HwndStylusInputProvider.cs
- FacetChecker.cs
- PipeStream.cs
- CompositeFontInfo.cs
- EventMappingSettingsCollection.cs
- DetailsViewDeletedEventArgs.cs
- IndicFontClient.cs
- ProfileService.cs
- Empty.cs
- RtfNavigator.cs
- X509ChainPolicy.cs
- ToolStripControlHost.cs
- CommandDevice.cs
- DbSetClause.cs
- ServicesExceptionNotHandledEventArgs.cs
- XhtmlBasicImageAdapter.cs
- SafeEventLogWriteHandle.cs
- SvcMapFile.cs
- BasePattern.cs
- TemplatePropertyEntry.cs
- ParallelDesigner.cs
- InputLanguageManager.cs
- VectorValueSerializer.cs
- WebHttpDispatchOperationSelectorData.cs
- HostedElements.cs
- XamlInt32CollectionSerializer.cs
- SemaphoreFullException.cs