a using System; a using System.Collections.Generic; a using System.Linq; a using System.Text; // namespace keyword is used to define a namespace, the namespace is mainly used to solve the problem of naming conflicts // namespace there is a role will organize a set of classes related to an abstract space inside, you must reference // namespace to access the contents of the namespace namespace ConsoleApplication1 { class Program { static void Main ( String [] args) { // C # built a lot of simple data type, also known as the basic data types // divided into three categories: integer data, floating point data types and character // integer data types: Short, int, Long // Note also, integer data It has signed and unsigned, //8bit byte Console.WriteLine ( " sbyte Type maximum value is: " + sbyte .MaxValue); Console.WriteLine ( " sbyte Type minimum value is: " + sbyte .MinValue); Console.WriteLine ( " byte Type maximum value: " + byte .MaxValue); Console.WriteLine ( " byte type minimum value is: " + byte .MinValue); // Short 16bit Console.WriteLine ( " Short type maximum value is: " + Short .MaxValue); Console.WriteLine ( " Short Type minimum value is: " + Short .MinValue); Console.WriteLine ( " ushort Type maximum value is: " + ushort .MaxValue); Console.WriteLine ( " ushort Type minimum value is: " + ushort .MinValue); // int 32bit Console.WriteLine ( " An int is: " + int .MaxValue); Console.WriteLine ( " minimum is of type int: " + int .MinValue); Console.WriteLine ( " uint type maximum was:" + Uint .MaxValue); Console.WriteLine ( " minimum uint type is: " + uint .MinValue); // long 64bit Console.WriteLine ( " maximum value of the long type is: " + long .MaxValue); Console .WriteLine ( " minimum long type is: " + long .MinValue); Console.WriteLine ( " maximum ulong type is: " + ulong .MaxValue); Console.WriteLine ( " minimum ulong type is: "+ head .MinValue); // float There are three types: a float, Double, decimal // wherein currency for decimal data type, the data of high precision, is effective decimals plurality @ character, there are two types: and String char // char is a unicode character type, character sets can represent a wide // not general implicit type conversion in C #, required display data type conversion Console.WriteLine ( " maximum char type is: " + ( Long ) char .MaxValue); Console.WriteLine ( " minimum char type is: " + ( Long ) char .MinValue); Console.WriteLine ( " characters maximum char type represented as:" + ( Char ) char .MaxValue); Console.WriteLine ( " characters minimum char type represented as: " + ( char ) char .MinValue); // String is a unicode string type String strGreeting; Console .WriteLine ( " Please enter the greeting: " ); strGreeting = Console.ReadLine (); Console.WriteLine ( " your input is welcome words: " + strGreeting); // Note that string in C # can be connected two way, with the heavy load off the operator + or join function // because no learning content to the template, here temporarily introduced // Finally, there is a particular basic data types bool type, which has two values and true to false // Note that, C # and C, C # and C ++ is different, can not implicitly nonzero value indicates the amount of bool IF ( true ) Console.WriteLine ( " using a true constant " ); / * * The following compulsory type conversion is not successful, it requires special attention place IF ((BOOL). 1) Console.WriteLine ( "true constant use"); * / Console.Read (); } } }
-------------------------------------------------- ------------split line------------------------------------ ---------------------------
1, individual articles are original, welcome to reprint, please retain the source: https: //www.cnblogs.com/volcanol/
2, access to industrial PLC, inverter, HMI, computers, Windows, Linux, embedded enlarge click: Access to information
3. If you think the article is helpful to you can go to the page and a half portion of a reward, or the venue: a reward
4, or recommend a page in the lower right corner yo! ! !
-------------------------------------------------- ------------split line------------------------------------ ---------------------------