CSharpTest.Net
StringConverter Class
Members  Example  See Also  Send Feedback Download Help File
CSharpTest.Net.Library Assembly > CSharpTest.Net.Utils Namespace : StringConverter Class

Glossary Item Box

Handles the conversion of data to and from strings for serialization. Can alternatly be configured to provide other transforms for display or other outputs.

Syntax

Visual Basic (Declaration) 
Public Class StringConverter 
C# 
public class StringConverter 

Example

Library/Library.Test/TestStringConvert.cs

C#Copy Code
DateTime date = new DateTime(2000, 1,2,3,4,5,6);
string dt = date.ToString();

StringConverter c = new StringConverter();

Assert.AreNotEqual(dt, c.ToString(date));

c.Add<DateTime>(DateTime.TryParse, delegate(DateTime value) { return value.ToString(); });

Assert.AreEqual(dt, c.ToString(date));
VB.NETCopy Code
Dim [date] As New DateTime(2000, 1, 2, 3, 4, 5, _
    6)
Dim dt As String = [date].ToString()

Dim c As New StringConverter()

Assert.AreNotEqual(dt, c.ToString([date]))

c.Add(Of DateTime)(DateTime.TryParse, Function(value As DateTime) Do
    Return value.ToString()
End Function)

Assert.AreEqual(dt, c.ToString([date]))

Inheritance Hierarchy

System.Object
   CSharpTest.Net.Utils.StringConverter

Requirements

Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7

See Also

Generated with Document! X 2011 by Innovasys