青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

C++ Programmer's Cookbook

{C++ 基礎} {C++ 高級} {C#界面,C++核心算法} {設計模式} {C#基礎}

Namespaces/Identifiers

Namespaces

You should not call classes with the using keyword. Hence, the code in Listing 1.4.2 results in a compilation error because Console is a class:

Listing 1.4.2

// compilation error
using System.Console;

Because the term Console is one of the classes located in the System namespace, you apply it along with its built-in methods. For example, you can write text to the command prompt by using the WriteLine() method of the Console class, as shown in Listing 1.4.3.

Listing 1.4.3

Console.WriteLine("Hello World");

Even though you cannot directly apply the class names along with the using directive, you can create an alias, as shown in Listing 1.4.4:

Listing 1.4.4

using mydotnet = System.Console;

After that, you have to apply the alias name, mydotnet, in your C# program, as shown in Listing 1.4.5:

Listing 1.4.5

mydotnet.WriteLine("Hello C#");

You can, however, completely omit the namespace declaration (with the using keyword) in a C# program. But, as an alternative, you can refer to the namespace name in the beginning of the relevant line of each statement, as shown in Listing 1.4.6:

Listing 1.4.6

System.Console.WriteLine("Welcome to C#");

A list of .NET namespaces is shown in the following table:

System.Collections System.IO
System.Data System.Net
System.Data.OleDb System.Reflection
Stsrem.Data.SqlClient System.Runtime.InteropServices
System.Data.OracleClient System.Runtime.Remoting
System.Diagnostics System.Security
System.Drawing System.Threading
System.Drawing.Drawing2D      System.Web
System.Drawing.Printing System.Xml
System.Windows.Forms

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

---------------------------------------------------------------------------
Assembly

An assembly is a file that is automatically generated by the compiler upon successful compilation of every .NET application. It can be either a Dynamic Link Library or an executable file. It is generated only once for an application and upon each subsequent compilation the assembly gets updated. The entire process will run in the background of your application; there is no need for you to learn deeply about assemblies. However, a basic knowledge about this topic will help you to understand the architecture behind a .NET application.

 

An Assembly contains Intermediate Language (IL) code, which is similar to Java byte code. In the .NET language, it consists of metadata. Metadata enumerates the features of every "type" inside the assembly or the binary. In addition to metadata, assemblies also have a special file called Manifest. It contains information about the current version of the assembly and other related information.

In .NET, there are two kinds of assemblies, such as Single file and Multi file. A single file assembly contains all the required information (IL, Metadata, and Manifest) in a single package. The majority of assemblies in .NET are made up of single file assemblies. Multi file assemblies are composed of numerous .NET binaries or modules and are generated for larger applications. One of the assemblies will contain a manifest and others will have IL and Metadata instructions.
-----------------------------------------------------------------------------------------------------------------------------------------------------

 

Identifiers

Identifiers are names given to namespaces, classes, methods, variables, and interfaces. An identifier must be a whole word and start with either a letter or an underscore. It can be any combination of letters, numbers, and underscores. But, it should not start with a number. Prior to .NET, programmers were using Hungarian-notation guidelines for naming identifiers; however, with .NET Microsoft has recommended Pascal and Camel notations for identifiers. They have also suggested using semantics in the identifier name. Another point you should bear in mind is that identifiers should not be the same as a C# keyword as listed in the section "Keywords." For example, the following code is illegal:

// Error. int cannot be used as a variable name as it a keyword
int int = 5;
 

Identifiers in C# are case sensitive. For instance, X is not equal to x. Some programmers use the @ prefix as a first character when declaring identifiers to avoid a clash with a keyword, but it is not a recommended practice. The following names are valid identifiers in C#:

  1. Hello
  2. hello
  3. H_ello
  4. HelloWorld
  5. X
  6. x
Note: In C#, class names can be different from file names.

You should name the variables using the standard DataType prefixes. Also, the first letter after the prefix should be capitalized. Table 1.6.1 shows a list of prefixes for the various .NET DataTypes. You will learn more about DataTypes in Part 3 of C#—Learning with the FAQs.

Table 1.6.1 List of C# Data Types

Data TypePrefixExample
ArrayarrarrNumber
BooleanblnblnSelect
BytebytbytNumber
CharchrchrPick
DateTimedtmdtmPick
DecimaldecdecPoint
DoubledbldblData
IntegerintintVar
LonglnglngMiles
ObjectobjobjVar
ShortshrshrNumber
SinglesngsngNumber
StringstrstrAddress

Interfaces are usually named with an "I" as the first letter. All Windows Forms controls should be named with the special prefixes, as shown in Table 1.6.2. This is to avoid confusion and also to distinguish among other controls in a complex project. As explained above, the first letter after the prefix should be capitalized. Once you master the naming conventions and prefixes, it will be very easy for you to write and debug the code at a later stage.

Table 1.6.2 List of prefixes for Windows Forms controls

Control NamePrefixExample
ButtonbtnbtnSubmit
TextBoxtxttxtFname
CheckBoxchkchkHobbies
RadioButtonradradMale
ImageimgimgIndia
LabellbllblCity
CalendarcalcalDate

It is beyond the scope of this FAQ to cover the prefixes of all the .NET controls. You will find a detailed list of them in the MSDN Library. (Perform a search using the phrase "naming guidelines")

posted on 2005-11-18 12:49 夢在天涯 閱讀(428) 評論(0)  編輯 收藏 引用 所屬分類: C#/.NET

公告

EMail:itech001#126.com

導航

統計

  • 隨筆 - 461
  • 文章 - 4
  • 評論 - 746
  • 引用 - 0

常用鏈接

隨筆分類

隨筆檔案

收藏夾

Blogs

c#(csharp)

C++(cpp)

Enlish

Forums(bbs)

My self

Often go

Useful Webs

Xml/Uml/html

搜索

  •  

積分與排名

  • 積分 - 1811721
  • 排名 - 5

最新評論

閱讀排行榜

青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
      <noscript id="pjuwb"></noscript>
            <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
              <dd id="pjuwb"></dd>
              <abbr id="pjuwb"></abbr>
              亚洲综合首页| 免费不卡在线观看av| 午夜精品国产精品大乳美女| 一区二区日韩欧美| 亚洲一区二区三区精品在线观看 | 亚洲丰满在线| 亚洲人成网站色ww在线| 亚洲看片免费| 欧美另类videos死尸| 免费一区二区三区| 欧美大片一区二区| 亚洲成人在线视频播放 | 日韩视频一区二区三区在线播放| 亚洲片区在线| 亚洲欧美偷拍卡通变态| 久久久噜噜噜久噜久久| 免费日韩av电影| 91久久精品日日躁夜夜躁国产| 一区二区精品在线| 久久av一区二区三区| 欧美不卡视频| 国产精品一区二区在线| 亚洲国产cao| 亚洲欧美影音先锋| 欧美高清视频| 亚洲欧美激情在线视频| 美女任你摸久久| 国产精品一区二区三区久久久 | 亚洲一区二区伦理| 久久综合99re88久久爱| 夜夜爽99久久国产综合精品女不卡| 欧美一区二区三区在线观看视频| 欧美丰满高潮xxxx喷水动漫| 国产女主播一区二区三区| 亚洲国产精彩中文乱码av在线播放| 亚洲男人的天堂在线观看| 欧美成人免费网站| 性欧美激情精品| 欧美性感一类影片在线播放| 亚洲国产三级| 久久亚洲综合网| 亚洲欧美乱综合| 欧美午夜寂寞影院| 日韩视频精品在线观看| 久久一区二区三区超碰国产精品| 亚洲少妇一区| 欧美色综合天天久久综合精品| 伊人一区二区三区久久精品| 欧美一级午夜免费电影| 亚洲精选一区二区| 欧美成人综合在线| 亚洲激情女人| 亚洲国产精品久久久| 久久精品一区二区国产| 国产精品自在在线| 午夜精品久久久久久久99黑人| 亚洲精选久久| 欧美日韩蜜桃| 一区二区三区欧美在线| 亚洲电影自拍| 欧美成人国产一区二区| 亚洲福利小视频| 欧美视频在线不卡| 亚洲精品字幕| 亚洲国产精品www| 噜噜爱69成人精品| 亚洲第一在线| 欧美国产日韩xxxxx| 男人天堂欧美日韩| 一本高清dvd不卡在线观看| 亚洲精品国偷自产在线99热| 欧美视频福利| 久久精品中文| 欧美成人官网二区| 亚洲天堂成人| 性伦欧美刺激片在线观看| 一区二区在线视频观看| 亚洲国产精品一区二区尤物区| 欧美日韩成人在线| 欧美一区国产一区| 久久婷婷国产麻豆91天堂| 亚洲欧洲三级电影| 一区二区免费在线观看| 国产午夜精品福利| 亚洲第一精品久久忘忧草社区| 欧美日韩视频一区二区| 欧美在现视频| 欧美激情偷拍| 久久日韩精品| 国产精品v欧美精品v日本精品动漫 | 欧美国产精品中文字幕| 欧美剧在线观看| 欧美中文字幕视频在线观看| 久久夜色精品国产| 亚洲综合欧美日韩| 玖玖精品视频| 欧美在线影院| 欧美了一区在线观看| 欧美淫片网站| 欧美精品一区二区三区视频| 久久精品理论片| 欧美激情麻豆| 久久精品最新地址| 欧美精品久久久久a| 亚洲欧美韩国| 美国十次了思思久久精品导航| 亚洲视频1区| 欧美承认网站| 国产精品色婷婷| 亚洲人精品午夜在线观看| 欧美日韩国产影片| 欧美mv日韩mv国产网站| 欧美精品一二三| 老司机午夜精品视频| 欧美精品一卡| 亚洲国产日韩欧美在线动漫| 国产精品久久综合| 亚洲精品一区在线观看香蕉| 国产一区二区看久久| 亚洲无线视频| 亚洲另类一区二区| 这里只有精品在线播放| 欧美日韩国产在线观看| 男女精品视频| 国产精品电影在线观看| 亚洲激情在线| 有码中文亚洲精品| 欧美一区在线看| 亚洲欧美自拍偷拍| 国产精品国产自产拍高清av王其 | 亚洲国产日韩一区二区| 亚洲精品你懂的| 亚洲免费成人av| 99热免费精品| 亚洲图色在线| 欧美一级久久久| 久久久久国色av免费看影院| 免费美女久久99| 亚洲高清在线| 国产日产亚洲精品系列| 亚洲午夜激情免费视频| 久久这里只有| 久久久夜夜夜| 亚洲高清在线视频| 久久久久综合网| 欧美激情1区2区3区| 一区在线电影| 欧美黄色视屏| 亚洲激情一区二区| 亚洲手机视频| 欧美日韩亚洲综合一区| 亚洲小视频在线观看| 亚洲一区中文字幕在线观看| 国产精品亚洲成人| 亚洲欧美日韩在线| 欧美成人a∨高清免费观看| 国产精品午夜电影| 久久免费视频这里只有精品| 欧美日韩日本网| 亚洲欧美综合一区| 亚洲一二三区在线观看| 国产亚洲成精品久久| 老司机免费视频一区二区| 欧美成人一区二区三区片免费| 夜久久久久久| 国产精品久久夜| 免费观看一级特黄欧美大片| 最新日韩中文字幕| 欧美伊人久久久久久久久影院 | 一本色道久久综合狠狠躁篇怎么玩 | 欧美成人乱码一区二区三区| 亚洲国产欧美不卡在线观看| 亚洲欧美中文日韩v在线观看| 国产乱码精品一区二区三| 免费成人高清视频| 9久re热视频在线精品| 欧美精品在线视频| 久久99在线观看| 亚洲国产精品va在线看黑人动漫 | 玖玖综合伊人| 亚洲毛片在线观看| 国产日韩欧美在线看| 免费观看亚洲视频大全| 亚洲欧美日韩视频一区| 美女诱惑黄网站一区| 亚洲欧美视频在线观看| 曰韩精品一区二区| 国产日韩精品一区二区三区在线| 久久国产一区| 亚洲免费大片| 欧美国产亚洲另类动漫| 亚洲欧美中文日韩在线| 一本色道**综合亚洲精品蜜桃冫| 国产精品久久久久久妇女6080| 免费在线观看一区二区| 亚洲小视频在线观看| 一本色道久久精品| 免费精品99久久国产综合精品| 欧美亚洲综合在线| 亚洲午夜久久久|