C # data type sorting

Source: Internet
Author: User

When I came into contact with VB6.0 for programming, I feel that VB is easy to understand. For Beginners, it is easy to get a graphical interface that is easy to get interested in. I have been using VB for one year. After two exercises, namely student management system and computer room charging system, I should say that I have a certain understanding of VB.

I recently read the book "big talk Design Patterns", and I learned C # By the way. Although I am familiar with the data types in C #, it is still somewhat different from VB. Sort it out today and try again when necessary.


<喎?http: www.bkjia.com kf ware vc " target="_blank" class="keylink"> VcD4KPHA + forward/forward + 2aO7tbHIu87Sw8fSssTcvavL/forward/qzcd1_m2hozwvcd4kpha + lead = "http://www.bkjia.com/uploadfile/Collfiles/20140103/20140103091358141.jpg" alt = "\">

1. Integer type

C # Data Type

Size

Value Range

Sbyte

Signed 8-digit integer

-128 ~ 127

Byte

Unsigned 8-digit integer

0-255

Short

Signed 16-digit integer

-32768-32767

Ushort

Unsigned 16-digit integer

0-65535

Int

Signed 32-bit integer

-2147489648-2147483647

Uint

Unsigned 32-bit integer

0-42994967295

Long

Signed 64-bit integer

-263-263

Ulong

Unsigned 64-bit integer

0-264

2. Character Type

C # uses the Unicode Character Set to represent the character type.

3. Real Number Type

C # Data Type

Size

Value Range

Float

32-Bit Single-precision real number

1.5*10-45-3.4*1038

Double

64-bit double-precision real number

5.0*10-324-1.7*10308

Demcimal

128-digit decimal real number

1.0*10-28-7.9*1028

4. boolean type

The value can only be true or false. The bool type corresponds to the System. Boolea structure in the. NET class library. It occupies 4 bytes in the computer, that is, 32 is the storage space.

5. Structure Type:

The process of organizing a series of related information into a single entity is the process of creating a structure.

Struct person
{

String m_name; // name
Int m_age; // age
String m_sex; // gender

}

6. Enumeration type:

It is mainly used to represent a logically associated item and combination. Use the keyword enum to define.

Enum Weekday

{

Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday

}

Ii. Reference Type

The reference types include class, interface, delegate, and array ).

1. class ):

Class is the basic unit of object-oriented programming and a data structure that contains data members, function members, and nested types. Data members of a class include constants, fields, and events. Function members include methods, attributes, index indicators, operators, constructors, and destructor. The class and structure both contain their own members, but the main difference between them is that the class is the reference type, while the structure is the value type.

Class supports the Inheritance Mechanism. through inheritance, the derived class can expand the data members and Function Methods of the base class to achieve code reuse and design reuse.

2. interface ):

To call each other between applications, an agreement must be reached in advance. the called party describes the services that it can provide in the agreement. In C #, this protocol is an interface. The method declaration in the interface definition does not include the access restriction modifier or the method Execution Code. If a class inherits an interface, it must implement the service defined by the interface. That is, the method in the implementation interface.

3. Delegate: The delegate term encapsulates the call process of a method. The use process of delegation is divided into three steps:

1). Define delegate void HelloDelegate ();

2). instantiate HelloDelegate hd = new HelloDelegate (p1.Say); // method called by p1.Say

3). Call hd ();

4. array:

Arrays are mainly used for batch processing of data of the same data type. In C #, arrays must be initialized before they can be used.




Related Article

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.