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

Glossary Item Box

Constructs a default StringConverter object for serialization

Syntax

Visual Basic (Declaration) 
Public Function New()
C# 
public 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]))

Requirements

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

See Also

Generated with Document! X 2011 by Innovasys