C # Learning Basics (1) Naming conventions

Source: Internet
Author: User

The C # Language specification recommends creating a word identifier using a specific casing convention

Pascal case Identifier The first letter of each word is capitalized for the type name and member name for example: Cardeck,firstname

Camel case except for the first word, all the words in the identifier are capitalized for local variables and method parameters such as: Totalcyclecount,randomseedparm

All uppercase identifiers have uppercase letters for abbreviations

Console.WriteLine ("Mrs {0}", 18);

Any number of substitution tags and any number of values can be used in C #

--------------------------------------------------------------------------------------------------------------- ------------

If a broad description of the C and C + + program source code characteristics, you can say C program a set of functions and data types, C + + program is a set of functions and classes, and C # program is a set of type declaration

namespace MyProgram                // Create new namespace {     declarationonoftype A           // claim type      declarationonoftype B           // declaration type    class  C      {           Static void Main ()         //declaration type           {                    ...           }         }}

Learning C # is how you create and use types so you know what types are

Type by: name; The data structure used to hold data members; some behaviors and constraints

such as: The constituent elements of type int

Name

Int

Structure

Y Bytes

Behavior

32-bit integer

A type such as a short int long is called a simple type, and this type value stores a data item

While other types can store multiple data items, such as array types, you can store multiple data items of the same type. These data items are called array elements that can be indexed to get the members

However, there are other types of beast that can contain many different types of data items, the individual of which is called a member, and the members have unique names that differ from those obtained by the index in the array.

There are two types of members: data members and function members

Data members hold data related to the object or class itself of this class

The function member executes the code. Behavior of a function member definition type

Data members
XYZ DataMen1 datamen2//function member F1 () { exceutablecode}f2 () { Exceutablecode} ..... .....

C # offers 15 predefined types including 13 simple types and 2 non-simple type members

The names of all predefined types are made up of all lowercase letters

Two non-simple types: String Object

All pre-defined types are mapped directly to the underlying. NET type, the C # type name is. NET-type aliases

In addition to the 15 predefined types provided by C #, you can also create your own user-defined types

6 types can be created by the user themselves:

Classes type (Class)

struct type (struct)

Array type (arrays)

Enum type (enum)

delegate type (delegate)

Interface type (interface)

A type is created from a type declaration, and the type declaration contains the following information:

The kind of type to create

The name of the new type

Declaration (name and specification) for each member of a type except for the array and delegate types, which do not contain named members

Once you declare a type, you can create and use objects of this type, just as they are predefined types

C # Learning Basics (1) Naming conventions

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.