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
- Pair.cs
- GetWinFXPath.cs
- CharacterMetricsDictionary.cs
- ToolStripDropDownMenu.cs
- _BaseOverlappedAsyncResult.cs
- GrowingArray.cs
- ComPlusAuthorization.cs
- NTAccount.cs
- MemberCollection.cs
- EdgeProfileValidation.cs
- EventsTab.cs
- Encoding.cs
- AlignmentYValidation.cs
- DataView.cs
- BindingCollection.cs
- ClientSettingsSection.cs
- ForeignKeyConstraint.cs
- ObjectNotFoundException.cs
- OrthographicCamera.cs
- TemplatedWizardStep.cs
- SelectionPatternIdentifiers.cs
- MsmqIntegrationInputMessage.cs
- UrlMappingsSection.cs
- JsonWriter.cs
- XmlILConstructAnalyzer.cs
- SecurityContextSecurityToken.cs
- PlainXmlDeserializer.cs
- SelectedGridItemChangedEvent.cs
- HtmlGenericControl.cs
- ExtensionSimplifierMarkupObject.cs
- ToolStripRendererSwitcher.cs
- SecondaryIndexList.cs
- AmbiguousMatchException.cs
- XmlSchemaImporter.cs
- Buffer.cs
- Pair.cs
- FormsAuthenticationUser.cs
- SystemIcmpV4Statistics.cs
- SQLCharsStorage.cs
- NavigationCommands.cs
- ResourceLoader.cs
- RepeaterItemEventArgs.cs
- TransportManager.cs
- DataObject.cs
- UInt64.cs
- AudioException.cs
- LicenseManager.cs
- TransformerConfigurationWizardBase.cs
- _DigestClient.cs
- OverrideMode.cs
- OrderedDictionary.cs
- WindowsHyperlink.cs
- ActivitySurrogateSelector.cs
- MembershipPasswordException.cs
- GeneralTransform3DCollection.cs
- HttpListenerPrefixCollection.cs
- XmlMapping.cs
- TdsParserStaticMethods.cs
- PageBuildProvider.cs
- File.cs
- WebCategoryAttribute.cs
- PeerNameRecord.cs
- ProfilePropertySettingsCollection.cs
- WindowsFormsLinkLabel.cs
- PermissionSet.cs
- SmtpException.cs
- AttachedPropertyBrowsableAttribute.cs
- ColorPalette.cs
- PointAnimation.cs
- MiniMapControl.xaml.cs
- SoapCodeExporter.cs
- WebBrowserEvent.cs
- Attributes.cs
- RoleManagerEventArgs.cs
- DataGridCaption.cs
- AutoCompleteStringCollection.cs
- IgnoreDataMemberAttribute.cs
- JsonGlobals.cs
- HtmlInputCheckBox.cs
- BatchParser.cs
- BuildResult.cs
- TakeOrSkipWhileQueryOperator.cs
- DesignerSerializerAttribute.cs
- Point4DConverter.cs
- TimelineGroup.cs
- WebDisplayNameAttribute.cs
- OdbcConnectionHandle.cs
- Header.cs
- HorizontalAlignConverter.cs
- Encoding.cs
- DirectoryNotFoundException.cs
- PenThread.cs
- IndexedEnumerable.cs
- HttpWriter.cs
- LogReserveAndAppendState.cs
- ResXBuildProvider.cs
- XmlObjectSerializerWriteContextComplex.cs
- ApplicationManager.cs
- KerberosSecurityTokenAuthenticator.cs
- XhtmlStyleClass.cs