Spring.NET 1.3.0 RC1 for .NET 2.0 API Reference

StringArrayConverter Class

Converts a separated String to a String array.

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

System.Object
   TypeConverter
      StringArrayConverter

[Visual Basic]
Public Class StringArrayConverter
    Inherits TypeConverter
[C#]
public class StringArrayConverter : 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

Defaults to using the , (comma) as the list separator. Note that the value of the current CurrentCulture is not used.

If you want to provide your own list separator, you can set the value of the ListSeparator property to the value that you want. Please note that this value will be used for all future conversions in preference to the default list separator.

Please note that the individual elements of a string will be passed through as is (i.e. no conversion or trimming of surrounding whitespace will be performed).

This TypeConverter should be automatically registered with any IObjectWrapper implementations.

Example

 public class StringArrayConverterExample 
 {     
     public static void Main()
     {
         StringArrayConverter converter = new StringArrayConverter();
            
            string csvWords = "This,Is,It";
            string[] frankBoothWords = converter.ConvertFrom(csvWords);

            // the 'frankBoothWords' array will have 3 elements, namely
            // "This", "Is", "It".
            
            // please note that extraneous whitespace is NOT trimmed off
            // in the current implementation...
            string csv = "  Cogito ,ergo ,sum ";
            string[] descartesWords = converter.ConvertFrom(csv);
            
            // the 'descartesWords' array will have 3 elements, namely
            // "  Cogito ", "ergo ", "sum ".
            // notice how the whitespace has NOT been trimmed.
     }
 }
 

Requirements

Namespace: Spring.Core.TypeConversion

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

See Also

StringArrayConverter Members | Spring.Core.TypeConversion Namespace