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

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 夢在天涯 閱讀(439) 評論(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

搜索

  •  

積分與排名

  • 積分 - 1817886
  • 排名 - 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色综合久久久综合网| 亚久久调教视频| 亚洲午夜女主播在线直播| 国产精品美女主播在线观看纯欲| 亚洲图片欧美一区| 亚洲香蕉网站| 黄色一区二区三区四区| 男女激情久久| 欧美日韩国语| 久久国产精品久久精品国产| 欧美中文字幕第一页| 亚洲国产99| aa成人免费视频| 国产一区二区毛片| 亚洲国产欧美另类丝袜| 欧美日韩一区二区三区在线视频| 先锋亚洲精品| 久热精品在线视频| 亚洲欧美视频| 噜噜噜91成人网| 午夜日韩在线观看| 女仆av观看一区| 欧美一区二区三区在线观看 | 久久亚洲综合色| 欧美不卡在线视频| 欧美中文字幕久久| 欧美大成色www永久网站婷| 午夜久久久久久久久久一区二区| 久久久久国产免费免费| 亚洲尤物视频在线| 免费人成精品欧美精品| 欧美一区亚洲一区| 欧美日本视频在线| 奶水喷射视频一区| 国产婷婷色综合av蜜臀av| 亚洲国产日韩欧美| 好看的亚洲午夜视频在线| 一区二区三区四区五区精品| 亚洲电影av在线| 性高湖久久久久久久久| 亚洲天堂黄色| 欧美极品在线观看| 亚洲大胆视频| 在线日韩中文字幕| 久久高清一区| 欧美一区影院| 国产精品久久久久久久午夜| 最新高清无码专区| 亚洲国产日韩一区| 久久亚洲国产精品一区二区| 久久久777| 国产日韩欧美日韩大片| 亚洲一区二区在线播放| 亚洲综合二区| 欧美日韩综合| 99成人在线| 中文高清一区| 欧美日韩在线视频一区| 亚洲美女一区| 亚洲视频一区二区| 欧美涩涩视频| 一区二区三区四区国产精品| 在线一区二区视频| 欧美性生交xxxxx久久久| 亚洲精品国精品久久99热| 亚洲精品美女91| 欧美精品一区二区三| 亚洲全部视频| 亚洲五月婷婷| 国产精品入口夜色视频大尺度| 亚洲午夜电影网| 欧美中文在线免费| 狠狠色狠狠色综合日日tαg| 久久久久久久久岛国免费| 免费观看国产成人| 亚洲国产一区二区在线| 欧美精品久久久久久| 亚洲国产一区二区a毛片| 亚洲免费电影在线| 国产精品高精视频免费| 午夜日韩福利| 牛夜精品久久久久久久99黑人| 亚洲激情视频在线播放| 欧美日韩在线一区| 亚洲欧美视频一区| 欧美粗暴jizz性欧美20| 亚洲网友自拍| 国产日韩欧美在线播放| 蜜臀a∨国产成人精品| 亚洲日本理论电影| 久久大逼视频| 亚洲精华国产欧美| 欧美日在线观看| 久久国产毛片| 9色国产精品| 蜜臀a∨国产成人精品| 在线综合欧美| 樱桃视频在线观看一区| 欧美揉bbbbb揉bbbbb| 久久国产视频网| 日韩视频一区二区三区在线播放免费观看 | 亚洲三级国产| 久久久久成人精品| 亚洲全部视频| 国产麻豆成人精品| 欧美国产国产综合| 欧美在线观看天堂一区二区三区 | 亚洲午夜小视频| 一区视频在线看| 国产精品久久亚洲7777| 你懂的视频一区二区| 午夜综合激情| 一区二区成人精品| 欧美高清在线播放| 久久久久免费观看| 亚洲一级影院| 日韩视频在线你懂得| 一区二区在线观看视频| 国产精品性做久久久久久| 欧美成人嫩草网站| 久久久久成人网| 亚洲欧美日本国产专区一区| 亚洲人成人77777线观看| 老司机一区二区三区| 欧美一区二区播放| 亚洲自拍偷拍一区| 一区二区三区色| 亚洲精品乱码久久久久久黑人 | 亚洲精品国产无天堂网2021| 国产综合色精品一区二区三区| 欧美日韩在线播放三区| 欧美黄色视屏| 欧美大片在线观看一区| 久久一区二区三区四区| 久久精品国产99国产精品| 亚洲欧美日韩精品| 亚洲自拍16p| 亚洲伊人观看| 亚洲综合久久久久| 亚洲欧美日韩人成在线播放| 一区二区日本视频| 中文一区二区| 亚洲一区免费视频| 午夜天堂精品久久久久| 香蕉久久一区二区不卡无毒影院| 中文欧美字幕免费| 亚洲综合日韩中文字幕v在线| 亚洲网站视频福利| 亚洲欧美日韩一区二区三区在线| 亚洲深夜福利| 亚洲欧美中文另类| 久久激情一区| 农夫在线精品视频免费观看| 欧美1级日本1级| 欧美日韩精品欧美日韩精品一| 欧美日韩国产黄| 国产精品日韩在线| 韩日精品视频| 亚洲人被黑人高潮完整版| 一区二区三区视频在线观看 | 国产午夜精品理论片a级大结局| 国产亚洲一区二区在线观看| 经典三级久久| 99国产精品视频免费观看| 亚洲综合视频1区| 久久久不卡网国产精品一区| 欧美大香线蕉线伊人久久国产精品| 欧美大片免费久久精品三p| 日韩亚洲欧美在线观看| 亚洲欧美日韩电影| 玖玖玖国产精品| 国产精品久久久久久久久久久久 | 亚洲综合好骚| 老司机午夜免费精品视频 | 亚洲欧美国产制服动漫| 久久久久一区| 午夜精品99久久免费| 亚洲大胆人体在线| 亚洲视频高清| 久久久久中文| 国产精品日韩欧美一区二区三区 | 久久久久国产精品一区| 欧美精品一区二区在线观看| 国产九区一区在线| 亚洲国产一区二区三区高清| 亚洲午夜一区二区三区| 另类欧美日韩国产在线| 一区二区冒白浆视频| 久久中文字幕一区| 国产精品一区二区a| 亚洲精品日韩久久| 久久精品国产视频| 一区二区欧美视频| 免费看亚洲片| 国产综合香蕉五月婷在线| 亚洲免费一区二区| 亚洲欧洲在线播放| 快播亚洲色图| 激情小说亚洲一区|