Spring.NET 1.3.0 RC1 for .NET 2.0 API Reference

NameValueConverter Class

Custom TypeConverter implementation for NameValueCollection objects.

For a list of all members of this type, see NameValueConverter Members .

System.Object
   TypeConverter
      NameValueConverter

[Visual Basic]
Public Class NameValueConverter
    Inherits TypeConverter
[C#]
public class NameValueConverter : TypeConverter

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Remarks

Handles conversion from an XML formatted string to a NameValueCollection object (see below for an example of the expected XML format).

This converter must be registered before it will be available. Standard converters in this namespace are automatically registered by the ObjectWrapper class.

Example

Find below some examples of the XML formatted strings that this converter will sucessfully convert. Note that the name of the top level (document) element is quite arbitrary... it is only the content that matters (and which must be in the format <add key="..." value="..."/>. For your continued sanity though, you may wish to standardize on the top level name of 'dictionary' (although you are of course free to not do so).

  <dictionary>
    <add key="host" value="localhost" />
    <add key="port" value="8080" />
  </dictionary>

The following example uses a different top level (document) element name, but is equivalent to the first example.

  <web-configuration-parameters>
    <add key="host" value="localhost" />
    <add key="port" value="8080" />
  </web-configuration-parameters>

Requirements

Namespace: Spring.Core.TypeConversion

Assembly: Spring.Core (in Spring.Core.dll)

See Also

NameValueConverter Members | Spring.Core.TypeConversion Namespace