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

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

搜索

  •  

積分與排名

  • 積分 - 1815054
  • 排名 - 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>
              美女图片一区二区| 欧美激情网友自拍| 亚洲一区二区三| 亚洲国产成人一区| 欧美精品videossex性护士| 亚洲男女自偷自拍| 欧美伊久线香蕉线新在线| 免费久久99精品国产自在现线| 亚洲视频你懂的| 欧美日韩精品二区第二页| 夜夜嗨av色综合久久久综合网 | 久久久精品五月天| 午夜伦欧美伦电影理论片| 亚洲伦理中文字幕| 欧美成人免费一级人片100| 欧美一区二区三区的| 欧美影院成人| 久久免费视频网| 欧美日韩中文| 极品日韩av| 日韩视频精品在线| 欧美一区二区视频在线观看| 亚洲毛片一区| 久久精品国产在热久久| 欧美一区二区精品| 午夜精品久久99蜜桃的功能介绍| 欧美刺激性大交免费视频| 国产亚洲a∨片在线观看| 亚洲第一区在线观看| 老**午夜毛片一区二区三区| 一区二区欧美亚洲| 先锋亚洲精品| 欧美一区二区免费观在线| 午夜精品久久久久久久白皮肤| 狠狠色综合网| 美国成人毛片| 日韩午夜在线| 女人天堂亚洲aⅴ在线观看| 亚洲激情校园春色| 亚洲女女女同性video| 黄色国产精品一区二区三区| 亚洲欧美成人综合| 日韩视频一区二区| 国产一级一区二区| 亚洲综合首页| 一区二区自拍| 狼狼综合久久久久综合网 | 亚洲视频专区在线| 在线播放日韩专区| 久久大香伊蕉在人线观看热2| 亚洲中无吗在线| 欧美乱大交xxxxx| 亚洲激情av在线| 亚洲第一精品夜夜躁人人爽 | 在线一区二区三区四区| 久久www免费人成看片高清| 一本久道久久综合婷婷鲸鱼| 亚洲图片激情小说| 影院欧美亚洲| 欧美一区二区三区四区在线观看| 亚洲精品自在在线观看| 午夜精品久久久久久99热| 免费一级欧美片在线播放| 男人插女人欧美| 亚洲激情视频网| 欧美激情国产精品| 9l国产精品久久久久麻豆| 亚洲一区二区三区中文字幕| 女生裸体视频一区二区三区| 老色批av在线精品| 在线精品国产欧美| 久久久久久久久蜜桃| 欧美一区二区三区四区夜夜大片| 欧美—级a级欧美特级ar全黄| 亚洲人成人77777线观看| 亚洲国产精品一区二区第四页av | 亚洲国产成人在线视频| 老司机67194精品线观看| 久久久综合免费视频| 国产综合久久久久久| 噜噜噜躁狠狠躁狠狠精品视频 | 狠狠色丁香婷综合久久| 免费成人av在线看| 亚洲永久免费| 99re6热只有精品免费观看| 午夜亚洲影视| 99视频精品| 最新国产の精品合集bt伙计| 国产日韩欧美麻豆| 欧美日韩精品免费观看| 久久久中精品2020中文| 亚洲午夜在线观看| 日韩视频一区二区三区| 欧美88av| 性欧美8khd高清极品| 亚洲电影免费观看高清完整版在线观看 | 在线综合+亚洲+欧美中文字幕| 国产精品一区在线播放| 久久久久亚洲综合| 久久国产精品免费一区| 欧美一二三区精品| 亚洲日本成人| 亚洲小说春色综合另类电影| 狠狠入ady亚洲精品| 国产在线拍揄自揄视频不卡99| 欧美日产国产成人免费图片| 久久躁狠狠躁夜夜爽| 久久九九99| 欧美福利视频| 欧美成人一品| 六月天综合网| 亚洲另类黄色| 亚洲人成在线观看一区二区| 久久亚洲国产精品日日av夜夜| 欧美一级在线亚洲天堂| 午夜在线播放视频欧美| 久久综合图片| 欧美激情一区在线观看| 欧美国产视频在线观看| 99re热精品| 一区二区三区欧美在线| 欧美在线观看视频在线| 久久综合九色综合欧美就去吻| 欧美激情一区二区| 国产精品福利在线| 亚洲国产三级在线| 久久精品女人的天堂av| 最新中文字幕一区二区三区| 亚洲欧美日本在线| 久久先锋资源| 国产一区二区三区久久悠悠色av | 在线综合亚洲| 女人天堂亚洲aⅴ在线观看| 亚洲欧美日韩国产成人精品影院| 欧美日韩国内| 西瓜成人精品人成网站| 欧美一站二站| 国产伦精品一区二区三区在线观看 | 亚洲毛片网站| 99热精品在线| 国产日韩精品一区观看| 欧美一区二区视频观看视频| 欧美亚洲日本网站| 亚洲在线一区二区| 国产欧美一区二区精品婷婷| 欧美亚洲一区二区三区| 你懂的亚洲视频| 久久久精品一区| 国产精品99一区二区| 欧美激情精品久久久久久黑人| 精品999成人| 一区二区激情小说| 亚洲第一区中文99精品| 亚洲人成欧美中文字幕| 国语自产精品视频在线看| 欧美国产日韩免费| 国产精品盗摄久久久| 久久这里有精品视频| 欧美午夜不卡视频| 欧美国产亚洲精品久久久8v| 久久久久免费观看| 欧美日韩另类在线| 久久亚洲视频| 国产日韩1区| 欧美亚洲视频在线观看| 欧美一级免费视频| 欧美成人一区在线| 国产精品免费一区二区三区在线观看 | 午夜精品福利视频| 午夜精品一区二区三区在线播放 | 欧美黄色片免费观看| 欧美成人免费在线观看| 欧美成人激情视频| 久久国产精品网站| 欧美黄色免费| 欧美高清视频在线播放| 国产精品久久久久7777婷婷| 久久婷婷色综合| 欧美日本一区二区三区| 久久婷婷麻豆| 亚洲欧洲日产国产综合网| 亚洲欧美日韩专区| 亚洲丰满少妇videoshd| 欧美黄色一区| 一区二区三区日韩在线观看| 99国产麻豆精品| 激情欧美丁香| 久久久精品免费视频| 久久久天天操| 亚洲欧洲一区二区三区久久| 欧美黑人多人双交| 日韩视频一区二区三区在线播放免费观看 | 久久国产欧美精品| 狠狠色综合网| 在线不卡亚洲| 在线成人免费视频| 好看的亚洲午夜视频在线| 国产精品一区二区男女羞羞无遮挡| 欧美fxxxxxx另类| 欧美日韩aaaaa|