首页
会员中心
到顶部
到尾部
文科毕业论文

Overview of C# programming language

时间:2020/10/14 14:34:48  作者:  来源:  查看:0  评论:0
内容摘要: C # (pronounced "C sharp", the Chinese transliteration no. Reading professionals generally "C sharp", is now generally read a lot of non...

C # (pronounced "C sharp", the Chinese transliteration no. Reading professionals generally "C sharp", is now generally read a lot of non-professional "C jing". C # is Microsoft's release of an object-oriented, running on. NET Framework on Advanced programming language. and is scheduled to professional developers in the Microsoft forums (PDC) on debut. C # is Microsoft researcher Anders Hejlsberg's latest achievements. C # and Java seem to have surprisingly similar; It includes a such as single inheritance, interfaces, and Java is almost the same syntax and compiled into intermediate code and then run the process. But
C # and Java have a noticeably different, it draws on a feature of Delphi, and COM (Component Object Model) is directly integrated, and it is Microsoft. NET windows network framework of the protagonist.
C # is a safe, stable, simple, from C and C + + derived from the object-oriented programming languages. Its succession of C and C + + power at the same time to remove the complexity of some of their characteristics (for example, there is no macros and templates does not allow multiple inheritance). C # combines the simple VB Visual C + + operation and high operating efficiency, the ability to operate its powerful, elegant style syntax, language features innovative and convenient support for component-oriented programming has become. NET development preferred语言.
And C # become the ECMA and ISO standards. C # seems to based on the C + + languages, but into the other languages such as Delphi, Java, VB and so on.
In this article, I will study the creation of a new computer language the general motivation, and specifically what are the reasons leading to the emergence of a C #. Then I will introduce it with C # and Java, c, c + + the similarities. Secondly, I there will be some discussion of Java and C # in between the high-level, and the basis for the difference. I will use to measure the development of large-scale applications in multiple languages, when the necessary knowledge (or lack of knowledge of this level) to the end of this article, which is. NET and C # as a major strategy. At present, C # and. NET is also only in C # language rules, as well as the Windo
windows 2000 a "d preview version", as well as the rapid increase in the MSDN documentation on the form of collection (not the final shape).
Microsoft c # language definition is from the C and C + + inherited, and language is also reflected in many elements of this. C # in the designers of C + + inherited from the optional options than Java to a wide range of some (for example, struts) It also added new features of its own (for example, the definition of the source code version). but it is too immature, it is impossible挤垮Java.C # also need to evolve into a developer to accept and use of language. The current Microsoft It's this new language is also worth noting that large building momentum. At present everybody's reaction was: "This is Java's fight back."
C # is more like a number of Java, while Microsoft on this issue remain silent. This is the expected thing, I think, because Java has a very successful company using Java reported that their productivity than C + + was improved.
Java enormous impact and the widespread acceptance of it we have been working on this language and the programmer platform shows the number of significant (estimated worldwide total of 2.5 million programmers using Java). by this language the number of applications is amazing and has infiltrated every level of computing, including wireless computing and mobile phones (such as the invention of Java phones in Japan). C # can the user access to this area of the courtesy it? We must wait and wait and see, as from SSI's CEO and Chairman Kalpathi S. Sure
sh, as pointed out, "I found that all these are gradual. If C # does not exist, we can always return to Java or C and C + +. These are not entirely new technology; they are in a larger sense, only the big Company market gimmicks. We must give them time to settle down to see if these are not really what the impact of IT industry. "
C # from Java inherited characteristics
Categories: category in C # in the statement and is very similar to Java. This is reasonable because experience tells us that the work of a good Java model. Java keyword import has been replaced by using, it has played a similar role. The beginning of the implementation of a class The starting point is a static method Main (). the following Hello World program to display the basic form:
using System;
class Hello
{
static void Main()
{
Console.WriteLine("Hello, world");
}
}
In this example, System, including the name point to a basic C # Utility Class collections namespace (namespace). This namespace includes the Console class, which in this case be used to output a string. Type can be abstract and non-succession: a been declared as abstract class can not be instantiated; it can only be used as a base class. C # keyword sealed as Java keyword final, it affirms that a class is not abstract, but it can not be Another category was used as the base class. interface: the same as in the Java, an interface is a set of
The definition of a collection of abstract methods. When a class or structure to achieve an interface, it must be defined in this interface all the methods. A single category to achieve a number of interfaces. Maybe later there will be some subtle differences, but the characteristics did not appear to change compared with Java. Boolean operations: conditional expression is the result of Boolean data types, Boolean data type is such a language independent data types. from Boolean type to other types, there is no direct conversion process. Boolean constants true and false are keywords in C #. Error Handling: If Java in, through out and capture the abnormal object to manage the process of error handling. Memory management: from the bottom. NET Framework garbage collector for automatic memory.
C # from C and C + + inheritance of characteristics
Compiler: compile directly into a standard form of the binary executable. But C # is not the source was compiled into a binary executable form, but in the middle of a language similar to JAVA byte code. If the front of the Hello World program is saved as a text file and named Hello.cs, it will be compiled into the executable program named Hello.exe.
Structure: A structure of C # and C + + the structure is similar, because it can contain data declarations and methods. However, unlike C + +, C # and type of structure is different and does not support inheritance. However, the same with Java that a structure interface can be achieved.
Pre-compiled: C # in support of the existence of conditions of pre-compiled compiler directives, warnings, error reports and compile the control line. Precompiled commands available are:
# define
# undef
# if
# elif
# else
# endif
# warning
# error
# line []
There is no # include pseudo-instructions. You can not use # define statements for the symbolic value, it does not exist to replace the concept of source code - these symbols can only be used for # if and # elif directives in pseudo. # Line in the pseudo-instruction the figures (and optional name) to modify the line there are No. # warning and # error output file name.
Operator overloading: A number of operators can be overloaded, while others can not. In particular, there is no assignment operator can be overloaded. Can be a single head was overloaded operator is:
+ -! ~ + + - True false
Can be overloaded binary operators are:
+ - * / % & | ^ << >> == != > < >= <=
Unique features of C #
C # the most fascinating places and Java is that it's different, rather than similarities. Of this section (and in this series most of the second part of) on the C # and Java to achieve different places or not the characteristics of Java.
Intermediate code: Microsoft in the user choose when to be compiled into MSIL binary when a lot of room to stay.'s Claim that Microsoft is very careful not MSIL explanatory, but has become a binary was compiled. It is also aware of many - if not most, if - the procedure to Java programmers is inevitable that more than anything in the preparation of C should be slow. and decided that the realization of the procedure based on the MSIL (referring to the use of C #, Visual Basic, " Managed C ++"-- C + + of a line with the CLS version - such as language of proceedings) will be over in terms of performance, "interpretative" Java code. When
However, this also needs to be proved, because the C # and other compiler generates MSIL has not yet released. However, the Java JIT compiler enabled widespread Java and C # in the same relative performance. As "C # is a Java language compiler is explanation, "a statement such as more than business skills. Java's intermediate code and the compilation of MSIL are intermediate forms of language, their run-time or other, when compiled into machine code.
Namespace declaration: When you create a procedure, you create a namespace in one or more categories. The same name in this space (outside of class) you may be a statement interface, enumerated type and structure. must use the using keyword to invoke the content of other namespaces.
Basic data types: C # than C, C + + or Java a wider range of data types. These types are bool, byte, ubyte, short, ushort, int, uint, long, ulong, float, double, and decimal. The same as Java All these types have a fixed size. Also, as C and C + +, each data type are signed and unsigned types. the same with Java, a character variable that contains a 16-bit Unicode characters. C # new data type is decimal data types, data for the currency, it can store 28 10-band digital.
Two basic categories: the name of the class object of all other types of base class. And a name string as the object of the same type also is part of the language. As part of the existence of language means that the compiler may use it -- - whether in the proceedings when you write a string with quotation marks, the compiler creates a string object to save it.
Parameter Passing: The method can be a statement to accept a variable number of parameters. Default method parameter is the value of the basic data transfer types. Ref keyword can be used to force a variable passed by reference, which allows a variable can accept a return value. out keyword statement can reference process, and the ref is different, it does not need this parameter to specify the initial value.
COM integration with: C # for Windows program may be the biggest selling point is its seamless integration with the COM has, COM is a component of Microsoft's Win32 technology. In fact, there may be in any final. NET languages to prepare clients and server-side COM . C # prepared the class can be a subclass of the existence of COM components; generated a class can also be used as a COM component, and then can use, for example, JScript language subclass of it in order to get the third COM components. the result of this phenomenon led to the emergence of a runtime environment, in this environment is the Web services components that can be used with any. NET language Subclassing.
Subscript index: an index with the attribute in addition to not using the property name to refer to a category but figures in square brackets to anonymous quote (as the same as using the array subscript) is similar to the outside.  public class ListBox: Control
{
private string[] items;
public string this[int index]
{
get
{
return items[index];
}
set
{
items[index] = value;
Repaint();
}
}
}
A cycle can be used to quote an anonymous member of the string within the array, as the following:
ListBox listBox = ...;
listBox [0] = "hello";
Console.WriteLine (listBox [0]);
Acting and feedback: a proxy object, including a visit to a particular method of targeting specific information needed. As long as it as a smart way to target on the list. Proxy object can be moved to another place, and then access it through to The method has been in existence for type-safe call. a feedback is exceptional agents. event keywords will be used in time of the incident was as a statement of proxy method calls.

  


相关评论
广告联系QQ:45157718 点击这里给我发消息 电话:13516821613 杭州余杭东港路118号雷恩国际科技创新园  网站技术支持:黄菊华互联网工作室 浙ICP备06056032号