Convert.ChangeType : System Convert « Data Type « C# / CSharp Tutorial






using System;

public sealed class ComplexNumber
{
    public ComplexNumber( double real, double imaginary ) {
        this.real = real;
        this.imaginary = imaginary;
    }

    private readonly double real;
    private readonly double imaginary;
}

public sealed class MainClass
{
    static void Main() {
        ComplexNumber num1 = new ComplexNumber( 1.12345678, 2.12345678 );

        string str = (string) Convert.ChangeType( num1, typeof(string) );
    }
}








2.56.System Convert
2.56.1.Use System.Convert to convert string to Int16
2.56.2.Convert a System.String into a System.Boolean using System.Convert
2.56.3.Convert.ChangeType
2.56.4.data type convert