What Is C?


What Is C#?

C#, as mentioned earlier, is one of the languages that can be used to create applications that will run in the .NET CLR. It is an evolution of the C and C++ languages and has been created by Microsoft specifically to work with the .NET platform. Because it is a recent development, the C# language has been designed with hindsight, taking into account many of the best features from other languages, while clearing up their problems.

Developing applications using C# is simpler than using C++, because the language syntax is simpler. However, C# is a powerful language, and there is little you might want to do in C++ that you can't do in C#. Having said that, those features of C# that parallel the more advanced features of C++, such as directly accessing and manipulating system memory, can only be carried out using code marked as unsafe. This advanced programmatic technique is potentially dangerous (hence its name), because it is possible to overwrite system-critical blocks of memory with potentially catastrophic results. For this reason, and others, this book will not cover this topic.

At times, C# code is slightly more verbose than C++. This is a consequence of C# being a type-safe language (unlike C++). In layperson's terms, this means that once some data has been assigned to a type, it cannot subsequently transform itself into another unrelated type. Consequently, there are strict rules that must be adhered to when converting between types, which means that you will often need to write more code to carry out the same task in C# than you might write in C++, but you get the benefits that code is more robust and debugging is simpler — .NET can always track what type a piece of data is at any time. In C#, you therefore may not be able to do things such as "take the region of memory 4 bytes into this data and 10 bytes long and interpret it as X," but that's not necessarily a bad thing.

C# is just one of the languages available for .NET development, but in my opinion it is certainly the best. It has the advantage of being the only language designed from the ground up for the .NET Framework and may be the principal language used in versions of .NET that are ported to other operating systems. To keep languages such as the .NET version of Visual Basic as similar as possible to their predecessors yet compliant with the CLR, certain features of the .NET code library are not fully supported. By contrast, C# is able to make use of every feature that the .NET Framework code library has to offer. The latest version of .NET includes several improvements to the C# language, partly in response to requests from developers, making it even more powerful.

What Kind of Applications Can I Write with C#?

the .NET Framework has no restrictions on the types of applications that are possible, as discussed earlier. C# uses the Framework and so also has no restrictions on possible applications. However, here are a few of the more common application types:

  • Windows Applications: These are applications, such as Microsoft Office, which have a familiar Windows look and feel about them. This is made simple by using the Windows Forms module of the .NET Framework, which is a library of controls (such as buttons, toolbars, menus, and so on) that you can use to build a Windows user interface (UI).

  • Web Applications: These are Web pages such as might be viewed through any Web browser. the .NET Framework includes a powerful system of generating Web content dynamically, allowing personalization, security, and much more. This system is called ASP.NET (Active Server Pages .NET), and you can use C# to create ASP.NET applications using Web Forms.

  • Web Services: These are a new and exciting way of creating versatile distributed applications. Using Web services you can exchange virtually any data over the Internet, using the same simple syntax regardless of the language used to create a Web service or the system that it resides on.

Any of these types may also require some form of database access, which can be achieved using the ADO.NET (Active Data Objects .NET) section of the .NET Framework. Many other resources can be drawn on, such as tools for creating networking components, outputting graphics, performing complex mathematical tasks, and so on.

C# in This Book

The first section of this book deals with the syntax and usage of the C# language without too much emphasis on the .NET Framework. This is necessary, because you won't be able to use the .NET Framework at all without a firm grounding in C# programming. You start off even simpler, in fact, and leave the more involved topic of object-oriented programming (OOP) until you've covered the basics. These will be taught from first principles, assuming no programming knowledge at all.

Once you have done this, you will be ready to move on to developing the types of application listed in the last section. Section two of this book will look at Windows Forms programming, Section three will look at Web application and Web service programming, Section four will examine data access (for database, file system and XML data), and Section five covers some other .NET topics of interest (such as more about assemblies and graphics programming).




Beginning Visual C# 2005
Beginning Visual C#supAND#174;/sup 2005
ISBN: B000N7ETVG
EAN: N/A
Year: 2005
Pages: 278

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net