Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / CompMod / System / ComponentModel / CollectionConverter.cs / 1305376 / CollectionConverter.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
/*
*/
namespace System.ComponentModel {
using Microsoft.Win32;
using System.Collections;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.Runtime.Serialization.Formatters;
using System.Runtime.Remoting;
using System.Runtime.InteropServices;
using System.Security.Permissions;
///
/// Provides a type converter to convert
/// collection objects to and from various other representations.
///
[HostProtection(SharedState = true)]
public class CollectionConverter : TypeConverter
{
///
/// Converts the given
/// value object to the
/// specified destination type.
///
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) {
if (destinationType == null) {
throw new ArgumentNullException("destinationType");
}
if (destinationType == typeof(string)) {
if (value is ICollection) {
return SR.GetString(SR.CollectionConverterText);
}
}
return base.ConvertTo(context, culture, value, destinationType);
}
///
/// Gets a collection of properties for
/// the type of array specified by the value parameter using the specified context and
/// attributes.
///
public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes) {
//return new PropertyDescriptorCollection(null);
return null;
}
///
/// Gets a value indicating whether this object
/// supports properties.
///
public override bool GetPropertiesSupported(ITypeDescriptorContext context) {
return false;
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
/*
*/
namespace System.ComponentModel {
using Microsoft.Win32;
using System.Collections;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.Runtime.Serialization.Formatters;
using System.Runtime.Remoting;
using System.Runtime.InteropServices;
using System.Security.Permissions;
///
/// Provides a type converter to convert
/// collection objects to and from various other representations.
///
[HostProtection(SharedState = true)]
public class CollectionConverter : TypeConverter
{
///
/// Converts the given
/// value object to the
/// specified destination type.
///
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) {
if (destinationType == null) {
throw new ArgumentNullException("destinationType");
}
if (destinationType == typeof(string)) {
if (value is ICollection) {
return SR.GetString(SR.CollectionConverterText);
}
}
return base.ConvertTo(context, culture, value, destinationType);
}
///
/// Gets a collection of properties for
/// the type of array specified by the value parameter using the specified context and
/// attributes.
///
public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes) {
//return new PropertyDescriptorCollection(null);
return null;
}
///
/// Gets a value indicating whether this object
/// supports properties.
///
public override bool GetPropertiesSupported(ITypeDescriptorContext context) {
return false;
}
}
}
// 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
- CheckedListBox.cs
- BamlResourceSerializer.cs
- TemplateApplicationHelper.cs
- XmlDocumentViewSchema.cs
- OleDbRowUpdatingEvent.cs
- PersonalizableAttribute.cs
- BypassElementCollection.cs
- OleDbStruct.cs
- XPathItem.cs
- TextFindEngine.cs
- ConstructorExpr.cs
- Italic.cs
- BitmapMetadata.cs
- StorageMappingItemLoader.cs
- SystemColorTracker.cs
- AddInStore.cs
- milexports.cs
- FollowerQueueCreator.cs
- DocumentReference.cs
- AssemblyInfo.cs
- WsiProfilesElementCollection.cs
- PropertyGridCommands.cs
- DynamicValueConverter.cs
- ResXResourceReader.cs
- LinkLabel.cs
- SmiConnection.cs
- Automation.cs
- ComponentCommands.cs
- ServiceHostingEnvironment.cs
- HandlerFactoryCache.cs
- _FtpControlStream.cs
- MarkupExtensionSerializer.cs
- HttpCapabilitiesEvaluator.cs
- remotingproxy.cs
- HashCodeCombiner.cs
- ToolbarAUtomationPeer.cs
- DataGridRow.cs
- SQLChars.cs
- recordstatefactory.cs
- AsyncCompletedEventArgs.cs
- DynamicDocumentPaginator.cs
- HttpWriter.cs
- Literal.cs
- WindowsTitleBar.cs
- LayoutSettings.cs
- CodeAccessPermission.cs
- BaseAsyncResult.cs
- MethodImplAttribute.cs
- ItemCheckEvent.cs
- SafeNativeMethods.cs
- MatcherBuilder.cs
- WindowsTitleBar.cs
- _AuthenticationState.cs
- ListViewContainer.cs
- KeyPressEvent.cs
- validation.cs
- Publisher.cs
- SpanIndex.cs
- MasterPageBuildProvider.cs
- ValueOfAction.cs
- DataReaderContainer.cs
- ListViewInsertionMark.cs
- InfoCardRSAOAEPKeyExchangeDeformatter.cs
- CryptoProvider.cs
- DriveNotFoundException.cs
- BooleanSwitch.cs
- EffectiveValueEntry.cs
- FontWeights.cs
- TypeDelegator.cs
- IssuedTokenClientCredential.cs
- x509utils.cs
- BindingGroup.cs
- InputScope.cs
- Rfc2898DeriveBytes.cs
- AssociationSet.cs
- Zone.cs
- ClassValidator.cs
- CopyOfAction.cs
- ComponentCollection.cs
- OdbcUtils.cs
- XPathQilFactory.cs
- ChannelServices.cs
- KnownAssembliesSet.cs
- RequestCacheEntry.cs
- IgnoreFlushAndCloseStream.cs
- HtmlTableCellCollection.cs
- SpecialNameAttribute.cs
- AutomationAttributeInfo.cs
- VBIdentifierDesigner.xaml.cs
- AsyncPostBackTrigger.cs
- DocumentXPathNavigator.cs
- ConfigurationStrings.cs
- EntityDataSourceUtil.cs
- BaseComponentEditor.cs
- RegexInterpreter.cs
- DecimalFormatter.cs
- JsonEnumDataContract.cs
- MobileControlPersister.cs
- PixelShader.cs
- ImpersonateTokenRef.cs