C # in the middle number, type conversion,

xiaoxiao2021-03-06  65

Most of them exist in the form of text when data is converted to the ASP.NET page. Sometimes, in order to output, single-use display or implicit conversion is not possible, as needed in this section, data conversion.

String output:

INT INTAGE = 21;

String strage = intage.toString ();

When converting the DateTime value, you can specify the output style of the time by placing an optional parameter in parentheses. EG: Datecou.Tostring ("D");

Format code and its meaning:

D - The following format gives the Sun Moon Year: Thursday, September 21,2001

G - 09/22/2001 09:12:23

T - give the time: 01:23:22 hours

T - give me: 01:23

D - mm / dd / yyyy

data input

CONVERT functions Daquan:

Convert.TOBOOLEAN (); convert.tobyte (); convert.tochar (); convert.todatetime (); convert.todouble (); convert.todouble (); convert.toint16 (); convert.toint32 (); convert. TOINT64 (); convert.tosbyte (); convert.tosingle (); convert.touint16 (); convert.touint32 (); convert.touint64 ();

Seven, constant

Assignment: const Int absolutezero = -273;

It must be declared in the class definition without supersensome.

Eight, structured data type

1, array

Declare an array: string [] strs;

In order to generate a declarative array, initialization must be performed: strsz = new string [5];

Statement while initializing: string [] asp = new string [44];

The subscript of the array starts from 0.

Variable value of variables: ASP [0] = "SDF";

ASP [2] = "SDF";

......

or:

String [] ASP = New String [] {"ASDF", "ASDFAS"}

String [] ASP = new string [2] {"asdf", "asdfas"};

String [] ASP = {"ASDF", "ASDFAS"}

See example: