10 private class EnumTypeConverter<TEnum> :
TypeConverter where TEnum : struct
14 if (sourceType == typeof(
string))
23 string text = value as string;
24 if (text !=
null &&
Enum.TryParse(text, ignoreCase:
true, out TEnum result))
28 return base.ConvertFrom(context, culture, value);
32 private readonly ConfigurationProperty unicodeDecodingConformance =
new ConfigurationProperty(
"unicodeDecodingConformance", typeof(
UnicodeDecodingConformance),
UnicodeDecodingConformance.Auto,
new EnumTypeConverter<UnicodeDecodingConformance>(),
null, ConfigurationPropertyOptions.None);
34 private readonly ConfigurationProperty unicodeEncodingConformance =
new ConfigurationProperty(
"unicodeEncodingConformance", typeof(
UnicodeEncodingConformance),
UnicodeEncodingConformance.Auto,
new EnumTypeConverter<UnicodeEncodingConformance>(),
null, ConfigurationPropertyOptions.None);
36 private readonly ConfigurationPropertyCollection properties =
new ConfigurationPropertyCollection();
49 base[unicodeDecodingConformance] = value;
64 base[unicodeEncodingConformance] = value;
68 protected internal override ConfigurationPropertyCollection Properties
79 properties.Add(unicodeDecodingConformance);
80 properties.Add(unicodeEncodingConformance);
Provides contextual information about a component, such as its container and property descriptor.
UnicodeEncodingConformance
Controls how Unicode characters are output by the Overload:System.Net.WebUtility.HtmlEncode methods.
Represents the WebUtility element in the configuration file.
Provides the base class for enumerations.
Represents type declarations: class types, interface types, array types, value types,...
bool CanConvertFrom(Type sourceType)
Returns whether this converter can convert an object of the given type to the type of this converter.
Provides information about a specific culture (called a locale for unmanaged code development)....
Provides a unified way of converting types of values to other types, as well as for accessing standar...
UnicodeDecodingConformance
Controls how Unicode characters are interpreted by the Overload:System.Net.WebUtility....
WebUtilityElement()
Initializes a new instance of the T:System.Net.Configuration.WebUtilityElement class.