mscorlib(4.0.0.0) API with additions
IdnElement.cs
3 
4 namespace System.Configuration
5 {
7  public sealed class IdnElement : ConfigurationElement
8  {
9  private class UriIdnScopeTypeConverter : TypeConverter
10  {
11  public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
12  {
13  if (sourceType == typeof(string))
14  {
15  return true;
16  }
17  return base.CanConvertFrom(context, sourceType);
18  }
19 
20  public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
21  {
22  string text = value as string;
23  if (text != null)
24  {
25  switch (text.ToLower(CultureInfo.InvariantCulture))
26  {
27  case "all":
28  return UriIdnScope.All;
29  case "none":
30  return UriIdnScope.None;
31  case "allexceptintranet":
32  return UriIdnScope.AllExceptIntranet;
33  }
34  }
35  return base.ConvertFrom(context, culture, value);
36  }
37  }
38 
39  internal const UriIdnScope EnabledDefaultValue = UriIdnScope.None;
40 
41  private ConfigurationPropertyCollection properties = new ConfigurationPropertyCollection();
42 
43  private readonly ConfigurationProperty enabled = new ConfigurationProperty("enabled", typeof(UriIdnScope), UriIdnScope.None, new UriIdnScopeTypeConverter(), null, ConfigurationPropertyOptions.None);
44 
45  protected internal override ConfigurationPropertyCollection Properties
46  {
47  protected get
48  {
49  return properties;
50  }
51  }
52 
55  [ConfigurationProperty("enabled", DefaultValue = UriIdnScope.None)]
56  public UriIdnScope Enabled
57  {
58  get
59  {
60  return (UriIdnScope)base[enabled];
61  }
62  set
63  {
64  base[enabled] = value;
65  }
66  }
67 
69  public IdnElement()
70  {
71  properties.Add(enabled);
72  }
73  }
74 }
static CultureInfo InvariantCulture
Gets the T:System.Globalization.CultureInfo object that is culture-independent (invariant).
Definition: CultureInfo.cs:263
Definition: __Canon.cs:3
Provides contextual information about a component, such as its container and property descriptor.
UriIdnScope Enabled
Gets or sets the value of the T:System.Configuration.IdnElement configuration setting.
Definition: IdnElement.cs:57
Represents type declarations: class types, interface types, array types, value types,...
Definition: Type.cs:18
bool CanConvertFrom(Type sourceType)
Returns whether this converter can convert an object of the given type to the type of this converter.
Provides the configuration setting for International Domain Name (IDN) processing in the T:System....
Definition: IdnElement.cs:7
Provides information about a specific culture (called a locale for unmanaged code development)....
Definition: CultureInfo.cs:16
UriIdnScope
Provides the possible values for the configuration setting of the T:System.Configuration....
Definition: UriIdnScope.cs:4
Provides a unified way of converting types of values to other types, as well as for accessing standar...
IdnElement()
Initializes a new instance of the T:System.Configuration.IdnElement class.
Definition: IdnElement.cs:69