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
- TemplateInstanceAttribute.cs
- WebDisplayNameAttribute.cs
- SettingsPropertyValueCollection.cs
- SqlConnectionStringBuilder.cs
- XmlSyndicationContent.cs
- WebServiceBindingAttribute.cs
- HttpConfigurationContext.cs
- DataColumnSelectionConverter.cs
- XPathArrayIterator.cs
- TdsRecordBufferSetter.cs
- BoolExpr.cs
- IssuedTokenClientBehaviorsElement.cs
- IgnoreFlushAndCloseStream.cs
- UserControlParser.cs
- BaseWebProxyFinder.cs
- FrameworkPropertyMetadata.cs
- ToolStripItemRenderEventArgs.cs
- ExeContext.cs
- CompensatableTransactionScopeActivity.cs
- CfgArc.cs
- X509Extension.cs
- BordersPage.cs
- ServiceThrottlingBehavior.cs
- ExceptionValidationRule.cs
- LinqDataSourceHelper.cs
- XhtmlBasicValidationSummaryAdapter.cs
- UnsafeNativeMethods.cs
- SqlUserDefinedAggregateAttribute.cs
- DataGridViewComponentPropertyGridSite.cs
- Scanner.cs
- Pen.cs
- ArgumentNullException.cs
- DoubleLink.cs
- TypeDefinition.cs
- SimpleBitVector32.cs
- RenderCapability.cs
- SystemIPInterfaceStatistics.cs
- M3DUtil.cs
- SimpleRecyclingCache.cs
- TriggerAction.cs
- ThemeableAttribute.cs
- XmlChoiceIdentifierAttribute.cs
- _PooledStream.cs
- StringExpressionSet.cs
- SelectionProcessor.cs
- SafeWaitHandle.cs
- PreviewKeyDownEventArgs.cs
- IsolatedStorageFile.cs
- CatalogPartCollection.cs
- ConvertEvent.cs
- ZeroOpNode.cs
- StrokeNodeOperations.cs
- ReadWriteObjectLock.cs
- Vector.cs
- TextWriter.cs
- InternalEnumValidatorAttribute.cs
- XmlParserContext.cs
- SplitterEvent.cs
- URLIdentityPermission.cs
- DeviceContexts.cs
- UniqueConstraint.cs
- ComEventsHelper.cs
- FormViewInsertEventArgs.cs
- DESCryptoServiceProvider.cs
- SecureStringHasher.cs
- PrintDialog.cs
- ExpressionPrefixAttribute.cs
- SafeNativeMethodsOther.cs
- IsolatedStorageFile.cs
- NotificationContext.cs
- If.cs
- DesignTimeSiteMapProvider.cs
- ThemeableAttribute.cs
- keycontainerpermission.cs
- ReverseInheritProperty.cs
- XPathChildIterator.cs
- Content.cs
- BrowserDefinitionCollection.cs
- DrawListViewColumnHeaderEventArgs.cs
- WebUtil.cs
- ListBoxItemAutomationPeer.cs
- ErrorProvider.cs
- MorphHelpers.cs
- StylusEditingBehavior.cs
- DesignDataSource.cs
- SchemaHelper.cs
- DeferredReference.cs
- AccessKeyManager.cs
- CodeLabeledStatement.cs
- DbInsertCommandTree.cs
- CaseInsensitiveComparer.cs
- DataView.cs
- SqlIdentifier.cs
- Rect3D.cs
- ImageIndexEditor.cs
- DataExpression.cs
- MetaColumn.cs
- TypeLoadException.cs
- BoolExpression.cs
- SizeAnimationBase.cs