You are previewing C# Quick Syntax Reference.
O'Reilly logo
C# Quick Syntax Reference

Book Description

The C# Quick Syntax Reference is a condensed code and syntax reference to the C# programming language. It presents the essential C# syntax in a well-organized format that can be used as a handy reference.

You won't find any technical jargon, bloated samples, drawn out history lessons or witty stories in this book. What you will find is a language reference that is concise, to the point and highly accessible. The book is packed with useful information and is a must-have for any C# programmer.

In the C# Quick Syntax Reference, you will find:

  • A concise reference to the C# language syntax.

  • Short, simple and focused code examples.

  • A well laid out table of contents and a comprehensive index allowing easy review.

  • What you'll learn

  • How to write your first C#-based HelloWorld as well as compile and run

  • What are variables, operators, strings, arrays, conditionals, loops, methods

  • What are and how to use the rich set of Classes in C#

  • How to do inheritance, member redefinitions, access levels, statics, properties and more

  • How to work with indexers, interfaces, abstracts, namespaces, and more

  • How to use enums, exception handling, operator overloading, custom conversions, constants

  • What are and how to use preprocessor, delegates, events, generics and struct

  • Who this book is for

    This book is a handy, pocket quick syntax reference for experienced C# as well as perhaps other programmers even new to C#.

    Table of Contents

    1. Title Page
    2. Contents at a Glance
    3. Contents
    4. About the Author
    5. About the Technical Reviewer
    6. Introduction
    7. CHAPTER 1: Hello World
      1. Choosing an IDE
      2. Creating a project
      3. Hello World
      4. IntelliSense
    8. CHAPTER 2: Compile and Run
      1. Visual Studio compilation
      2. Console compilation
      3. Comments
    9. CHAPTER 3: Variables
      1. Data types
      2. Declaration
      3. Assignment
      4. Integer types
      5. Floating-point types
      6. Char type
      7. Bool type
      8. Variable scope
    10. CHAPTER 4: Operators
      1. Arithmetic operators
      2. Assignment operators
      3. Combined assignment operators
      4. Increment and decrement operators
      5. Comparison operators
      6. Logical operators
      7. Bitwise operators
      8. Operator precedents
    11. CHAPTER 5: String
      1. String concatenation
      2. Escape characters
      3. String compare
      4. String members
      5. StringBuilder class
    12. CHAPTER 6: Arrays
      1. Array declaration
      2. Array allocation
      3. Array assignment
      4. Array access
      5. Rectangular arrays
      6. Jagged arrays
    13. CHAPTER 7: Conditionals
      1. If statement
      2. Switch statement
      3. Goto statement
      4. Ternary operator
    14. CHAPTER 8: Loops
      1. While loop
      2. Do-while loop
      3. For loop
      4. Foreach loop
      5. Break and continue
    15. CHAPTER 9: Methods
      1. Defining methods
      2. Calling methods
      3. Method parameters
      4. Params keyword
      5. Method overloading
      6. Optional parameters
      7. Named arguments
      8. Return statement
      9. Value and reference types
      10. Pass by value
      11. Pass by reference
      12. Ref keyword
      13. Out keyword
    16. CHAPTER 10: Class
      1. Object creation
      2. Accessing object members
      3. Constructor
      4. This keyword
      5. Constructor overloading
      6. Constructor chaining
      7. Initial field values
      8. Default constructor
      9. Object initializers
      10. Partial class
      11. Garbage collector
      12. Destructor
      13. Null keyword
      14. Nullable types
      15. Null-coalescing operator
      16. Default values
    17. CHAPTER 11: Inheritance
      1. Object class
      2. Downcast and upcast
      3. Is keyword
      4. As keyword
      5. Boxing
      6. Unboxing
    18. CHAPTER 12: Redefining Members
      1. Hiding members
      2. Overriding members
      3. Hiding and overriding
      4. Sealed keyword
      5. Base keyword
    19. CHAPTER 13: Access Levels
      1. Private access
      2. Protected access
      3. Internal access
      4. Protected internal access
      5. Public access
      6. Top-level access levels
      7. Inner classes
      8. Access level guideline
    20. CHAPTER 14: Static
      1. Accessing static members
      2. Static methods
      3. Static fields
      4. Static classes
      5. Static constructor
      6. Extension methods
    21. CHAPTER 15: Properties
      1. Auto-implemented properties
      2. Property advantages
      3. Read-only and write-only properties
      4. Property access levels
    22. CHAPTER 16: Indexers
      1. Indexer parameters
      2. Indexer overloading
    23. CHAPTER 17: Interface
      1. Interface signatures
      2. Interface example
      3. Functionality interface
      4. Class interface
    24. CHAPTER 18: Abstract
      1. Abstract members
      2. Abstract example
      3. Abstract classes and interfaces
    25. CHAPTER 19: Namespaces
      1. Nested namespaces
      2. Namespace access
      3. Using directive
    26. CHAPTER 20: Enum
      1. Enum example
      2. Enum constant values
      3. Enum constant type
      4. Enum access levels and scope
      5. Enum methods
    27. CHAPTER 21: Exception Handling
      1. Try-catch statement
      2. Catch block
      3. Finally block
      4. Using statement
      5. Throwing exceptions
    28. CHAPTER 22: Operator Overloading
      1. Operator overloading example
      2. Binary operator overloading
      3. Unary operator overloading
      4. Return types and parameters
      5. Overloadable operators
      6. True and false operator overloading
    29. CHAPTER 23: Custom Conversions
      1. Implicit conversion methods
      2. Explicit conversion methods
    30. CHAPTER 24: Constants
      1. Local constants
      2. Constant fields
      3. Readonly keyword
      4. Constant guideline
    31. CHAPTER 25: Preprocessor
      1. Preprocessor directive syntax
      2. Conditional compilation – #if and #endif
      3. Defining symbols
      4. Undefining symbols
      5. Conditional compilation - #elif and #else
      6. Diagnostic directives
      7. Line directive
      8. Region directive
    32. CHAPTER 26: Delegates
      1. Anonymous methods
      2. Lambda expressions
      3. Multicast delegates
      4. Delegate signature
      5. Delegates as parameters
    33. CHAPTER 27: Events
      1. Publisher
      2. Event keyword
      3. Event caller
      4. Raising events
      5. Subscriber
      6. Event handler
      7. Subscribing to events
    34. CHAPTER 28: Generics
      1. Generic methods
      2. Calling generic methods
      3. Generic type parameters
      4. Default value
      5. Generic classes
      6. Generic class inheritance
      7. Generic interfaces
      8. Generic delegates
      9. Generic events
      10. Generics and Object
      11. Constraints
      12. Multiple constraints
      13. Why to use constraints
    35. CHAPTER 29: Struct
      1. Struct variable
      2. Struct constructors
      3. Struct field initializers
      4. Struct inheritance
      5. Struct guideline
    36. CHAPTER 30: Asynchronous methods
      1. Async and await
      2. Async return types
      3. Custom async methods
    37. Index