Files
2026-06-04 11:42:34 +02:00

51 lines
3.2 KiB
C#

using System;
using System.Collections;
using System.Globalization;
namespace System.ComponentModel
{
/// <summary>Provides a type converter to convert collection objects to and from various other representations.</summary>
// Token: 0x02000063 RID: 99
public class CollectionConverter : TypeConverter
{
/// <summary>Converts the given value object to the specified destination type.</summary>
/// <returns>An <see cref="T:System.Object" /> that represents the converted value.</returns>
/// <param name="context">An <see cref="T:System.ComponentModel.ITypeDescriptorContext" /> that provides a format context. </param>
/// <param name="culture">The culture to which <paramref name="value" /> will be converted.</param>
/// <param name="value">The <see cref="T:System.Object" /> to convert. This parameter must inherit from <see cref="T:System.Collections.ICollection" />. </param>
/// <param name="destinationType">The <see cref="T:System.Type" /> to convert the value to. </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="destinationType" /> is null. </exception>
/// <exception cref="T:System.NotSupportedException">The conversion cannot be performed. </exception>
// Token: 0x060003BA RID: 954 RVA: 0x0000B700 File Offset: 0x00009900
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
{
if (destinationType == typeof(string) && value != null && value is ICollection)
{
return "(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>
/// <returns>A <see cref="T:System.ComponentModel.PropertyDescriptorCollection" /> with the properties that are exposed for this data type, or null if there are no properties. This method always returns null.</returns>
/// <param name="context">An <see cref="T:System.ComponentModel.ITypeDescriptorContext" /> that provides a format context. </param>
/// <param name="value">An <see cref="T:System.Object" /> that specifies the type of array to get the properties for. </param>
/// <param name="attributes">An array of type <see cref="T:System.Attribute" /> that will be used as a filter. </param>
// Token: 0x060003BB RID: 955 RVA: 0x0000B738 File Offset: 0x00009938
public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes)
{
return null;
}
/// <summary>Gets a value indicating whether this object supports properties.</summary>
/// <returns>false because <see cref="M:System.ComponentModel.CollectionConverter.GetProperties(System.ComponentModel.ITypeDescriptorContext,System.Object,System.Attribute[])" /> should not be called to find the properties of this object. This method never returns true.</returns>
/// <param name="context">An <see cref="T:System.ComponentModel.ITypeDescriptorContext" /> that provides a format context. </param>
// Token: 0x060003BC RID: 956 RVA: 0x0000B73C File Offset: 0x0000993C
public override bool GetPropertiesSupported(ITypeDescriptorContext context)
{
return false;
}
}
}