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
- Guid.cs
- SettingsProviderCollection.cs
- ObjectAssociationEndMapping.cs
- UserNameSecurityTokenProvider.cs
- RefreshPropertiesAttribute.cs
- ListViewSortEventArgs.cs
- InternalSafeNativeMethods.cs
- AuthenticationManager.cs
- SmtpNegotiateAuthenticationModule.cs
- ADMembershipProvider.cs
- XmlChildEnumerator.cs
- Point.cs
- DataColumnPropertyDescriptor.cs
- LocalServiceSecuritySettings.cs
- SerializationInfoEnumerator.cs
- InputLanguageManager.cs
- TextElementEditingBehaviorAttribute.cs
- IsolatedStoragePermission.cs
- ScrollProviderWrapper.cs
- Stylesheet.cs
- PermissionToken.cs
- SQLUtility.cs
- TransportBindingElementImporter.cs
- WebResourceAttribute.cs
- ContextMarshalException.cs
- xsdvalidator.cs
- ByteViewer.cs
- BamlLocalizationDictionary.cs
- dataSvcMapFileLoader.cs
- AssemblyCollection.cs
- DataContractSerializerOperationFormatter.cs
- GraphicsPath.cs
- MappingItemCollection.cs
- FamilyMap.cs
- PopOutPanel.cs
- TextFormatterImp.cs
- WhileDesigner.cs
- CacheManager.cs
- PngBitmapEncoder.cs
- ToolStripPanelCell.cs
- Vector3D.cs
- SiteMapPath.cs
- HandleCollector.cs
- RectValueSerializer.cs
- BooleanProjectedSlot.cs
- ConfigurationConverterBase.cs
- Int16AnimationUsingKeyFrames.cs
- InteropBitmapSource.cs
- HttpResponseHeader.cs
- ExceptQueryOperator.cs
- HttpsHostedTransportConfiguration.cs
- UTF7Encoding.cs
- TemplatedMailWebEventProvider.cs
- DBDataPermission.cs
- SafeWaitHandle.cs
- AlphaSortedEnumConverter.cs
- CodeDomComponentSerializationService.cs
- NameObjectCollectionBase.cs
- WebReferencesBuildProvider.cs
- Win32.cs
- ObjectRef.cs
- ColumnHeader.cs
- ProcessRequestArgs.cs
- CorePropertiesFilter.cs
- PropertyValueChangedEvent.cs
- PngBitmapDecoder.cs
- Point3DAnimation.cs
- ByteAnimationBase.cs
- FixedSOMTableRow.cs
- XamlTemplateSerializer.cs
- ItemsChangedEventArgs.cs
- SafeCertificateStore.cs
- DataListItemCollection.cs
- Rect3DValueSerializer.cs
- DropShadowBitmapEffect.cs
- Style.cs
- DispatcherHookEventArgs.cs
- TextElementAutomationPeer.cs
- MonthChangedEventArgs.cs
- BinarySerializer.cs
- PngBitmapEncoder.cs
- WebReference.cs
- PackageFilter.cs
- ClientSponsor.cs
- ModelPropertyCollectionImpl.cs
- ExeConfigurationFileMap.cs
- FlowDocumentScrollViewer.cs
- ActivityTrace.cs
- BaseCollection.cs
- Grid.cs
- ErrorWebPart.cs
- AppSettingsExpressionBuilder.cs
- PackageRelationship.cs
- SelectionGlyphBase.cs
- SortedSetDebugView.cs
- TableDetailsRow.cs
- PagedControl.cs
- CharEntityEncoderFallback.cs
- ModelItemImpl.cs
- DataGridViewAutoSizeModeEventArgs.cs