Chapter 4: Advanced C Topics

 
Chapter 4 - Advanced C# Topics
bySimon Robinsonet al.
Wrox Press 2002
  

Overview

At this point, we have covered all the basics of C# syntax as well as object-oriented programming in C#. We have in effect, learned enough to be able to use C# to write well designed object oriented programs. However, we haven't yet completed our coverage of the C# language, because C# also offers a number of more advanced features that can be extremely useful in some circumstances. Those features are what we will be looking at over the next two chapters.

The C# language relies extensively on its interaction with the .NET Framework and the base classes. In this chapter we will focus more on those advanced features that are predominantly part of the language itself, and in the next chapter, we will examine the topics for which support is provided mainly through the base classes, with minimal help from the C# language syntax.

The topics that we cover in this chapter are:

  • Errors and exception handling C#'s mechanism for handling error conditions, which allows us to provide custom handling for each type of error condition, and also to cleanly separate the code that identifies errors from the code that handles them.

  • User -defined casts Defining casts between your own classes.

  • Delegates The way in which C# allows code to refer to a method, without specifying which method is being referred to until run-time.

  • Events Notifying code when a particular action takes place, for example when the user clicks a mouse button.

  • The C# preprocessor A look at the advantages of preprocessing just before compilation.

  • Attributes A technique for marking items in your code that are of interest in some way.

  • Memory management under the hood We look under the hood at the heap and the stack and how value and reference variables are stored and the performance implications.

  • Unsafe code Declaring blocks of code as 'unsafe' in order to obtain direct memory access.

  


Professional C#. 2nd Edition
Performance Consulting: A Practical Guide for HR and Learning Professionals
ISBN: 1576754359
EAN: 2147483647
Year: 2002
Pages: 244

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