| File: System\ComponentModel\CollectionConverter.cs | Web Access |
| Project: src\runtime\src\libraries\System.ComponentModel.TypeConverter\src\System.ComponentModel.TypeConverter.csproj (System.ComponentModel.TypeConverter) |
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Collections; using System.Diagnostics.CodeAnalysis; using System.Globalization; namespace System.ComponentModel { /// <summary> /// Provides a type converter to convert collection objects to and from various other /// representations. /// </summary> public class CollectionConverter : TypeConverter { /// <summary> /// Converts the given value object to the specified destination type. /// </summary> public override object? ConvertTo(ITypeDescriptorContext? context, CultureInfo? culture, object? value, Type destinationType) { if (destinationType == typeof(string) && value is ICollection) { return SR.UsingResourceKeys() ? "(Collection)" : SR.Collection; } return base.ConvertTo(context, culture, value, destinationType); } /// <summary> /// Gets a collection of properties for the type of array specified by the value /// parameter using the specified context and attributes. /// </summary> [RequiresUnreferencedCode("The Type of value cannot be statically discovered. " + AttributeCollection.FilterRequiresUnreferencedCodeMessage)] public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext? context, object value, Attribute[]? attributes) { return new PropertyDescriptorCollection(null); } } }