Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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
- HtmlWindowCollection.cs
- CmsUtils.cs
- SqlCaseSimplifier.cs
- RequestCacheManager.cs
- ToolStripSplitButton.cs
- PrivacyNoticeBindingElementImporter.cs
- MaskedTextBox.cs
- Rotation3D.cs
- Odbc32.cs
- FlowDocumentScrollViewer.cs
- Configuration.cs
- XmlReaderSettings.cs
- ProcessHostFactoryHelper.cs
- userdatakeys.cs
- IntPtr.cs
- TcpServerChannel.cs
- HttpRequestTraceRecord.cs
- CopyNamespacesAction.cs
- BamlTreeMap.cs
- mediaeventargs.cs
- ValidatingPropertiesEventArgs.cs
- ToolStripInSituService.cs
- ThreadStaticAttribute.cs
- Help.cs
- ExpressionEditorAttribute.cs
- MailDefinition.cs
- StatusBarDrawItemEvent.cs
- TransformGroup.cs
- FactoryMaker.cs
- TextParagraph.cs
- ExtensionQuery.cs
- Cursors.cs
- MailWriter.cs
- ServerReliableChannelBinder.cs
- DataRowView.cs
- CryptoApi.cs
- Int32.cs
- StackBuilderSink.cs
- Helpers.cs
- DiagnosticTraceSource.cs
- dbdatarecord.cs
- PersonalizablePropertyEntry.cs
- SByte.cs
- Expressions.cs
- ACE.cs
- AssemblyFilter.cs
- _KerberosClient.cs
- AspProxy.cs
- SystemFonts.cs
- XslCompiledTransform.cs
- PeerEndPoint.cs
- XmlTextAttribute.cs
- PrivateUnsafeNativeCompoundFileMethods.cs
- DiscoveryClientDuplexChannel.cs
- SynchronizationContext.cs
- ReferencedAssembly.cs
- DataGridPagerStyle.cs
- Path.cs
- SharedStatics.cs
- ServicePointManagerElement.cs
- KeyValueInternalCollection.cs
- DNS.cs
- ManagedWndProcTracker.cs
- NativeMethods.cs
- TextHidden.cs
- IriParsingElement.cs
- List.cs
- Configuration.cs
- AppDomainFactory.cs
- Enum.cs
- StreamResourceInfo.cs
- Identifier.cs
- PropertyGeneratedEventArgs.cs
- StateBag.cs
- SyntaxCheck.cs
- EdmToObjectNamespaceMap.cs
- DragDeltaEventArgs.cs
- PropertyRecord.cs
- WeakRefEnumerator.cs
- IdentifierCreationService.cs
- Monitor.cs
- WebPartRestoreVerb.cs
- XmlSerializationReader.cs
- RoleGroupCollection.cs
- AdPostCacheSubstitution.cs
- RawContentTypeMapper.cs
- DisplayNameAttribute.cs
- IndicCharClassifier.cs
- LiteralControl.cs
- RNGCryptoServiceProvider.cs
- wgx_render.cs
- ReadWriteSpinLock.cs
- ConnectionPoint.cs
- AccessDataSourceView.cs
- AdPostCacheSubstitution.cs
- Line.cs
- XmlResolver.cs
- JavascriptCallbackMessageInspector.cs
- XdrBuilder.cs
- DependencyPropertyChangedEventArgs.cs