Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Data / System / Data / PrimaryKeyTypeConverter.cs / 1305376 / PrimaryKeyTypeConverter.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //[....] //[....] //----------------------------------------------------------------------------- namespace System.Data { using System.ComponentModel; using System.Globalization; using System.Data; internal sealed class PrimaryKeyTypeConverter : ReferenceConverter { // converter classes should have public ctor public PrimaryKeyTypeConverter() : base(typeof(DataColumn[])) { } public override bool GetPropertiesSupported(ITypeDescriptorContext context) { return false; } public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) { if (destinationType == typeof(String)) { return true; } return base.CanConvertTo(context, destinationType); } public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { if (destinationType == null) { throw new ArgumentNullException("destinationType"); } if (destinationType == typeof(string)) { return (new DataColumn[] {}).GetType().Name; } 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.Data { using System.ComponentModel; using System.Globalization; using System.Data; internal sealed class PrimaryKeyTypeConverter : ReferenceConverter { // converter classes should have public ctor public PrimaryKeyTypeConverter() : base(typeof(DataColumn[])) { } public override bool GetPropertiesSupported(ITypeDescriptorContext context) { return false; } public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) { if (destinationType == typeof(String)) { return true; } return base.CanConvertTo(context, destinationType); } public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { if (destinationType == null) { throw new ArgumentNullException("destinationType"); } if (destinationType == typeof(string)) { return (new DataColumn[] {}).GetType().Name; } 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
- ProtocolInformationReader.cs
- TraceRecords.cs
- ScrollBarRenderer.cs
- Int32Rect.cs
- PrinterSettings.cs
- PrintPageEvent.cs
- TextChangedEventArgs.cs
- PropertyValueChangedEvent.cs
- ProviderSettings.cs
- DataServices.cs
- Composition.cs
- SmtpNegotiateAuthenticationModule.cs
- CompiledIdentityConstraint.cs
- SafeHandles.cs
- SqlInternalConnection.cs
- DataGridViewComboBoxColumn.cs
- XPathCompileException.cs
- KeyInstance.cs
- Decorator.cs
- HTTP_SERVICE_CONFIG_URLACL_KEY.cs
- TimeSpanSecondsConverter.cs
- XXXInfos.cs
- Trace.cs
- BoundColumn.cs
- TextTreeObjectNode.cs
- SqlTransaction.cs
- IDictionary.cs
- BitmapSizeOptions.cs
- PassportAuthentication.cs
- BindingExpressionUncommonField.cs
- SerialReceived.cs
- PageRouteHandler.cs
- WinHttpWebProxyFinder.cs
- NoResizeHandleGlyph.cs
- FileFormatException.cs
- BrowserInteropHelper.cs
- XmlUtilWriter.cs
- CodeTypeOfExpression.cs
- AdPostCacheSubstitution.cs
- Byte.cs
- AnnotationService.cs
- XmlAtomicValue.cs
- WebHeaderCollection.cs
- COM2IVsPerPropertyBrowsingHandler.cs
- SQLBinaryStorage.cs
- TreeIterators.cs
- SecurityUtils.cs
- PhysicalOps.cs
- DataBindingExpressionBuilder.cs
- ElementMarkupObject.cs
- updatecommandorderer.cs
- RequiredAttributeAttribute.cs
- PropertyGridCommands.cs
- TcpConnectionPoolSettingsElement.cs
- ArgumentDesigner.xaml.cs
- TrustManagerPromptUI.cs
- RadioButton.cs
- StackOverflowException.cs
- SqlRowUpdatingEvent.cs
- Model3DGroup.cs
- LinqDataSourceEditData.cs
- DynamicRendererThreadManager.cs
- GridViewCancelEditEventArgs.cs
- CryptoProvider.cs
- XmlEnumAttribute.cs
- CompiledWorkflowDefinitionContext.cs
- BitmapSource.cs
- Encoder.cs
- ComEventsHelper.cs
- Listener.cs
- ListView.cs
- DPTypeDescriptorContext.cs
- BaseParser.cs
- FilterQuery.cs
- MenuItem.cs
- StrongNameMembershipCondition.cs
- GACMembershipCondition.cs
- BamlBinaryReader.cs
- DecoderFallback.cs
- TransactedReceiveData.cs
- DescendentsWalker.cs
- BodyGlyph.cs
- PowerStatus.cs
- Executor.cs
- UntypedNullExpression.cs
- wmiprovider.cs
- SmtpFailedRecipientException.cs
- BasicCellRelation.cs
- TransformerConfigurationWizardBase.cs
- TabItemAutomationPeer.cs
- ScrollItemPattern.cs
- IdentityReference.cs
- CustomGrammar.cs
- PerspectiveCamera.cs
- DbReferenceCollection.cs
- StreamSecurityUpgradeInitiator.cs
- DesignerTransactionCloseEvent.cs
- CodeArgumentReferenceExpression.cs
- HttpResponse.cs
- Soap.cs