C # variables, data type conversions, escape characters

Source: Internet
Author: User

Variable:

in the In C # , the types of variables are:int,double,string,Char , andbool are some of these types.

In C # , a variable's declaration can be a public global variable, or it can be a local variable inside a method.

For example: You can declare a local variable inside the entry method:

public static void Main (string[] args)

{

int i_01;

Double i_02;

String name1;

Char char1;

BOOL bool_01;

declare the variables, and be sure to initialize them.

i_01=2016;

i_02=3.1415926;

Name= " singing the motherland!" ";

Char1= ' a ';

Bool_01=true;

}


Data type conversions:

Implicitly-Typed conversions:

System.Console.WriteLine (" age =" +18);

convert integers to string types automatically

Explicit type conversions ( coercion type conversions ):

System.Console.WriteLine ((int.) 3.1415926);

force conversion to an integer by a parenthesis


Escape character:

\‘

\"

\\

\b

\ t

\v

\ n

\ r


This article is from the "Smile" blog, please be sure to keep this source http://yiyiweixiao.blog.51cto.com/2476874/1967793

C # variables, data type conversions, escape characters

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.