You are previewing C# 5.0 Programmer's Reference.
O'Reilly logo
C# 5.0 Programmer's Reference

Book Description

Stay ahead of the game with this comprehensive guide to the C# programming language

Well-known C# expert Rod Stephens gives novice and experienced developers a comprehensive tutorial and reference to standard C#. This new title fully covers the latest C# language standard, C# 5.0, as well as its implementation in the 2013 release of Visual Studio. The author provides exercises and solutions; and his C# Helper website will provide readers and students with ongoing support. This resource is packed with tips, tricks, tutorials, examples, and exercises and is the perfect professional companion for programmers who want to stay ahead of the game.

Author Rod Stephens is a well-known programming authority and has written more than 25 programming books covering C#, Java, VB, and other languages. His books have sold more than 150,000 copies in multiple editions. This book's useful exercises and solutions are designed to support training and higher education adoptions.

  • Learn the full range of C# programming language features

  • Quickly locate information for specific language features in the reference section

  • Familiarize yourself with handling data types, variables, constants, and much more

  • Experiment with editing and debugging code and using LINQ

  • Beginning through intermediate-level programmers will benefit from the accessible style of C# 5.0 Programmer's Reference and will have access to its comprehensive range of more advanced topics. Additional support and complementary material are provided at the C# Helper website, www.csharphelper.com. Stay up-to-date and improve your programming skills with this invaluable resource.

    Table of Contents

    1. Part I: The C# Ecosystem
      1. Chapter 1: The C# Environment
        1. Visual Studio
        2. The C# Compiler
        3. The CLR
        4. The .NET Framework
        5. Summary
        6. Exercises
      2. Chapter 2: Writing a First Program
        1. Types of Projects
        2. Console Applications
        3. Windows Forms Applications
        4. WPF Applications
        5. Windows Store Applications
        6. Summary
        7. Exercises
      3. Chapter 3: Program and Code File Structure
        1. Hidden Files
        2. Preprocessor Directives
        3. Code File Structure
        4. Comments
        5. Summary
        6. Exercises
    2. Part II: C# Language Elements
      1. Chapter 4: Data Types, Variables, and Constants
        1. Data Types
        2. Variable Declaration Syntax
        3. Initialization
        4. Literal Type Characters
        5. Data Type Conversion
        6. Scope
        7. Parameter Declarations
        8. Properties
        9. Enumerations
        10. Nullable Types
        11. Delegates
        12. Summary
        13. Exercises
      2. Chapter 5: Operators
        1. Arithmetic Operators
        2. Comparison Operators
        3. Logical Operators
        4. Bitwise Operators
        5. Conditional and Null-coalescing Operators
        6. Assignment Operators
        7. Operator Precedence
        8. The StringBuilder Class
        9. DateTime and TimeSpan Operations
        10. Operator Overloading
        11. Summary
        12. Exercises
      3. Chapter 6: Methods
        1. Method Declarations
        2. Extension Methods
        3. Lambda Expressions
        4. Variance
        5. Asynchronous Methods
        6. Summary
        7. Exercises
      4. Chapter 7: Program Control Statements
        1. Decision Statements
        2. Looping Statements
        3. Summary
        4. Exercises
      5. Chapter 8: LINQ
        1. Basic LINQ Query Syntax
        2. Advanced LINQ Query Syntax
        3. Other LINQ Methods
        4. LINQ Extension Methods
        5. LINQ to Objects
        6. LINQ to XML
        7. LINQ to ADO.NET
        8. PLINQ
        9. Summary
        10. Exercises
      6. Chapter 9: Error Handling
        1. Bugs Versus Undesirable Conditions
        2. try catch Blocks
        3. Summary
        4. Exercises
      7. Chapter 10: Tracing and Debugging
        1. The Debug Menu
        2. The Debug ⇒ Windows Submenu
        3. The Breakpoints Window
        4. The Immediate Window
        5. Trace Listeners
        6. Summary
        7. Exercises
    3. Part III: Object-Oriented Programming
      1. Chapter 11: OOP Concepts
        1. Classes
        2. Encapsulation
        3. Inheritance
        4. Polymorphism
        5. Summary
        6. Exercises
      2. Chapter 12: Classes and Structures
        1. Classes
        2. Structures
        3. Constructors
        4. Structure Instantiation Details
        5. Garbage Collection
        6. Events
        7. Static Methods
        8. Summary
        9. Exercises
      3. Chapter 13: Namespaces
        1. Collisions in .NET
        2. The using Directive
        3. The Default Namespace
        4. Making Namespaces
        5. Resolving Namespaces
        6. The global Namespace
        7. Summary
        8. Exercises
      4. Chapter 14: Collection Classes
        1. Arrays
        2. System.Collections
        3. Dictionaries
        4. CollectionsUtil
        5. Stacks and Queues
        6. Generic Collections
        7. Collection Initializers
        8. Iterators
        9. Summary
        10. Exercises
      5. Chapter 15: Generics
        1. Advantages of Generics
        2. Defining Generics
        3. Instantiating Generic Classes
        4. Generic Collection Classes
        5. Generic Methods
        6. Generics and Extension Methods
        7. Summary
        8. Exercises
    4. Part IV: Interacting with the Environment
      1. Chapter 16: Printing
        1. Windows Forms Printing
        2. WPF Printing
        3. Summary
        4. Exercises
      2. Chapter 17: Configuration and Resources
        1. Environment Variables
        2. Registry
        3. Configuration Files
        4. Resource Files
        5. Summary
        6. Exercises
      3. Chapter 18: Streams
        1. Stream
        2. FileStream
        3. MemoryStream
        4. BinaryReader and BinaryWriter
        5. TextReader and TextWriter
        6. StringReader and StringWriter
        7. StreamReader and StreamWriter
        8. Exists, OpenText, CreateText, and AppendText
        9. Custom Stream Classes
        10. Summary
        11. Exercises
      4. Chapter 19: File System Objects
        1. Filesystem Permissions
        2. .NET Framework Classes
        3. Using the Recycle Bin
        4. Summary
        5. Exercises
      5. Chapter 20: Networking
        1. Networking Classes
        2. Downloading Information
        3. Uploading Information
        4. Getting FTP Information
        5. Sending E-mail
        6. Sending Text Messages
        7. Summary
        8. Exercises
    5. Part V: Advanced Topics
      1. Chapter 21: Regular Expressions
        1. Building Regular Expressions
        2. Using Regular Expressions
        3. Summary
        4. Exercises
      2. Chapter 22: Parallel Programming
        1. Interacting with the User Interface
        2. BackgroundWorker
        3. Tasks
        4. Threads
        5. Coordinating Tasks
        6. Thread-Safe Objects
        7. Summary
        8. Exercises
      3. Chapter 23: ADO.NET
        1. Selecting a Database
        2. Using Bound Controls
        3. Loading DataSets
        4. Using ADO.NET
        5. Summary
        6. Exercises
      4. Chapter 24: XML
        1. Writing XML Data
        2. Reading XML Data
        3. Related Technologies
        4. Summary
        5. Exercises
      5. Chapter 25: Serialization
        1. XML Serialization
        2. JSON Serialization
        3. Binary Serialization
        4. Summary
        5. Exercises
      6. Chapter 26: Reflection
        1. Learning About Classes
        2. Getting and Setting Properties
        3. Getting Assembly Information
        4. Invoking Methods
        5. Running Scripts
        6. Summary
        7. Exercises
      7. Chapter 27: Cryptography
        1. Cryptographic Operations
        2. Randomness
        3. Symmetric Key Encryption
        4. Asymmetric Key Encryption
        5. Summary
        6. Exercises
    6. Part VI: Appendices
      1. Appendix A: Solutions to Exercises
        1. Chapter 1
        2. Chapter 2
        3. Chapter 3
        4. Chapter 4
        5. Chapter 5
        6. Chapter 6
        7. Chapter 7
        8. Chapter 8
        9. Chapter 9
        10. Chapter 10
        11. Chapter 11
        12. Chapter 12
        13. Chapter 13
        14. Chapter 14
        15. Chapter 15
        16. Chapter 16
        17. Chapter 17
        18. Chapter 18
        19. Chapter 19
        20. Chapter 20
        21. Chapter 21
        22. Chapter 22
        23. Chapter 23
        24. Chapter 24
        25. Chapter 25
        26. Chapter 26
        27. Chapter 27
      2. Appendix B: Data Types
        1. Casting and Converting Values
        2. Parsing Values
      3. Appendix C: Variable Declarations
        1. Initialization Expressions
        2. Using
        3. Enumerated Type Declarations
      4. Appendix D: Constant Declarations
      5. Appendix E: Operators
        1. Arithmetic Operators
        2. Comparison Operators
        3. Logical Operators
        4. Bitwise Operators
        5. Assignment Operators
        6. Conditional and Null-coalescing Operators
        7. Operator Precedence
        8. DateTime and TimeSpan Operators
        9. Operator Overloading
      6. Appendix F: Method Declarations
        1. Methods
        2. Property Procedures
        3. Lambda Functions and Expressions
        4. Extension Methods
      7. Appendix G: Useful Attributes
        1. Useful XML Serialization Attributes
        2. Useful JSON Serialization Attributes
        3. Binary Serialization Attributes
        4. Other Useful Attributes
      8. Appendix H: Control Statements
        1. Decision Statements
        2. Looping Statements
      9. Appendix I: Error Handling
      10. Appendix J: LINQ
        1. Basic LINQ Query Syntax
        2. LINQ Functions
        3. LINQ to XML
        4. LINQ to ADO.NET
        5. PLINQ
      11. Appendix K: Classes and Structures
        1. Classes
        2. Structures
        3. Constructors
        4. Destructors
        5. Events
      12. Appendix L: Collection Classes
        1. Arrays
        2. Collections
        3. Iterators
      13. Appendix M: Generic Declarations
        1. Generic Classes
        2. Generic Methods
      14. Appendix N: Printing and Graphics
        1. Windows Forms Printing
        2. WPF Printing
      15. Appendix O: Useful Exception Classes
        1. Standard Exception Classes
        2. Custom Exception Classes
      16. Appendix P: Date and Time Format Specifiers
        1. Standard Format Specifiers
        2. Custom Format Specifiers
      17. Appendix Q: Other Format Specifiers
        1. Standard Numeric Format Specifiers
        2. Custom Numeric Format Specifiers
        3. Numeric Formatting Sections
        4. Composite Formatting
        5. Enumerated Type Formatting
      18. Appendix R: Streams
        1. Stream Class Summary
        2. Stream
        3. BinaryReader and BinaryWriter
        4. TextReader and TextWriter
        5. StringReader and StringWriter
        6. StreamReader and StreamWriter
        7. Text File Stream Methods
      19. Appendix S: Filesystem Classes
        1. Framework Classes
        2. Special Folders
        3. Recycle Bin
      20. Appendix T: Regular Expressions
        1. Creating Regular Expressions
        2. Regular Expression Options
        3. Using Regular Expressions
      21. Appendix U: Parallel Programming
        1. Interacting with the User Interface
        2. PLINQ
        3. BackgroundWorker
        4. TPL
        5. Tasks
        6. Threads
      22. Appendix V: XML
        1. Special Characters
        2. Writing XML Data
        3. Reading XML Data
        4. Related Technologies
      23. Appendix W: Serialization
        1. XML Serialization
        2. JSON Serialization
        3. Binary Serialization
      24. Appendix X: Reflection
        1. Type
        2. MemberInfo
        3. EventInfo
        4. MethodInfo
        5. FieldInfo
        6. PropertyInfo
        7. ParameterInfo
    7. Titlepage
    8. Copyright
    9. About the Author
    10. About the Technical Editor
    11. Credits
    12. Acknowledgments
    13. Introduction
      1. Who Should Read This Book
      2. Approach
      3. Which Edition of Visual Studio Should You Use?
      4. How This Book Is Organized
      5. How to Use This Book
      6. Necessary Equipment
      7. Conventions
      8. Source Code
      9. Errata
      10. p2p.wrox.com
      11. Important URLs
    14. Advertisement
    15. End-User License Agreement