using System;
using System.Globalization;
namespace System.ComponentModel
{
/// Provides a type converter to convert string objects to and from other representations.
// Token: 0x020000C2 RID: 194
public class StringConverter : TypeConverter
{
/// Gets a value indicating whether this converter can convert an object in the given source type to a string using the specified context.
/// true if this converter can perform the conversion; otherwise, false.
/// An that provides a format context.
/// A that represents the type you wish to convert from.
// Token: 0x06000669 RID: 1641 RVA: 0x00010C90 File Offset: 0x0000EE90
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
{
return sourceType == typeof(string) || base.CanConvertFrom(context, sourceType);
}
/// Converts the specified value object to a object.
/// An that represents the converted value.
/// An that provides a format context.
/// The to use.
/// The to convert.
/// The conversion could not be performed.
// Token: 0x0600066A RID: 1642 RVA: 0x00010CAC File Offset: 0x0000EEAC
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
{
if (value == null)
{
return string.Empty;
}
if (value is string)
{
return (string)value;
}
return base.ConvertFrom(context, culture, value);
}
}
}