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
![Network programming in C#, Network Programming in VB.NET, Network Programming in .NET](/images/book.jpg)
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- SamlSecurityTokenAuthenticator.cs
- LambdaCompiler.Statements.cs
- Speller.cs
- DocumentGridPage.cs
- _IPv4Address.cs
- AppDomainFactory.cs
- PermissionSet.cs
- GroupBoxAutomationPeer.cs
- RegisteredArrayDeclaration.cs
- TreePrinter.cs
- FileInfo.cs
- TemplatePagerField.cs
- InvalidCastException.cs
- PtsHelper.cs
- EntityModelSchemaGenerator.cs
- PolicyConversionContext.cs
- DateTimePickerDesigner.cs
- GB18030Encoding.cs
- GuidConverter.cs
- StorageEndPropertyMapping.cs
- HttpListener.cs
- CodeLabeledStatement.cs
- AppDomainCompilerProxy.cs
- CommonRemoteMemoryBlock.cs
- RedirectionProxy.cs
- PersistenceTask.cs
- SafeNativeMethodsCLR.cs
- PackageRelationshipSelector.cs
- ScalarType.cs
- TemplatedMailWebEventProvider.cs
- RegexParser.cs
- QueryCoreOp.cs
- ObjectDataSourceStatusEventArgs.cs
- WebBrowserHelper.cs
- ArgumentException.cs
- ConfigurationStrings.cs
- FileCodeGroup.cs
- MetadataItem_Static.cs
- WebPartCollection.cs
- CodeAttributeArgument.cs
- ItemContainerProviderWrapper.cs
- TextPointerBase.cs
- SafeNativeMethods.cs
- LinearQuaternionKeyFrame.cs
- IRCollection.cs
- SessionStateContainer.cs
- WeakReference.cs
- ObjectSecurityT.cs
- TimeSpanOrInfiniteConverter.cs
- ScrollItemPatternIdentifiers.cs
- BinaryMessageFormatter.cs
- AssemblyAttributes.cs
- DashStyle.cs
- AppSettingsReader.cs
- TimerEventSubscription.cs
- DataGridCell.cs
- ArrayWithOffset.cs
- DataGridViewCellFormattingEventArgs.cs
- FtpRequestCacheValidator.cs
- OdbcUtils.cs
- PolicyLevel.cs
- IgnoreDataMemberAttribute.cs
- FunctionParameter.cs
- RawMouseInputReport.cs
- Material.cs
- Vector3DCollection.cs
- activationcontext.cs
- PauseStoryboard.cs
- securitycriticaldataformultiplegetandset.cs
- PersistenceMetadataNamespace.cs
- DbParameterHelper.cs
- Win32.cs
- PartBasedPackageProperties.cs
- ObjectDataSourceStatusEventArgs.cs
- SmtpSection.cs
- WebEventTraceProvider.cs
- Point4DConverter.cs
- ErrorRuntimeConfig.cs
- MergeFailedEvent.cs
- ApplicationCommands.cs
- GlyphsSerializer.cs
- Compiler.cs
- DataGridViewLinkColumn.cs
- BufferedReadStream.cs
- dsa.cs
- NavigationProperty.cs
- XamlClipboardData.cs
- ActivityDesigner.cs
- DispatcherEventArgs.cs
- SqlXmlStorage.cs
- PointAnimationClockResource.cs
- AttachedPropertyBrowsableForTypeAttribute.cs
- DataGridViewCellParsingEventArgs.cs
- SimpleTextLine.cs
- ItemsPanelTemplate.cs
- SHA256Managed.cs
- SQLMoneyStorage.cs
- HasCopySemanticsAttribute.cs
- AnonymousIdentificationSection.cs
- SectionRecord.cs