Get started with Visual C# programming with this great beginner's guide
Beginning C# 6 Programming with Visual Studio 2015 provides step-by-step directions for programming with C# in the .NET framework. Beginning with programming essentials, such as variables, flow control, and object-oriented programming, this authoritative text moves into more complicated topics, such as web and Windows programming and data access within both database and XML environments. After your introduction to each of the chapters, you are invited to apply your newfound knowledge in Try it Out sections, which reinforce learning and help you understand the practical applications of the new concepts you have explored. Through this approach, you can write useful programming code following each of the steps that you explore in this essential text.
* Discover the basics of programming with C#, such as variables, expressions, flow control, and functions
* Discuss how to keep your program running smoothly through debugging and error handling
* Understand how to navigate your way through key programming elements, such as classes, class members, collections, comparisons, and conversions
* Explore object-oriented programming, web programming, and Windows programming
Beginning C# 6 Programming with Visual Studio 2015 is a fundamental resource for any programmers who are new to the C# language.
Autorentext
About the authors
Benjamin Perkins is Senior Support Escalation Engineer at Microsoft, and an avid C# programmer with 15 years experience in enterprise-level IT solutions.
Jacob Vibe Hammer is a software engineer at Terma and co-author of a number of .NET books.
Jon D. Reid is a Product Solution Manager for IFS R&D (www.ifsworld.com) where he develops in C# for the Microsoft environment.
Zusammenfassung
Get started with Visual C# programming with this great beginner's guide
Beginning C# 6 Programming with Visual Studio 2015 provides step-by-step directions for programming with C# in the .NET framework. Beginning with programming essentials, such as variables, flow control, and object-oriented programming, this authoritative text moves into more complicated topics, such as web and Windows programming and data access within both database and XML environments. After your introduction to each of the chapters, you are invited to apply your newfound knowledge in Try it Out sections, which reinforce learning and help you understand the practical applications of the new concepts you have explored. Through this approach, you can write useful programming code following each of the steps that you explore in this essential text.
- Discover the basics of programming with C#, such as variables, expressions, flow control, and functions
- Discuss how to keep your program running smoothly through debugging and error handling
- Understand how to navigate your way through key programming elements, such as classes, class members, collections, comparisons, and conversions
- Explore object-oriented programming, web programming, and Windows programming
Beginning C# 6 Programming with Visual Studio 2015 is a fundamental resource for any programmers who are new to the C# language.
Inhalt
INTRODUCTION xix
PART I: THE OOP LANGUAGE
CHAPTER 1: INTRODUCING C# 3
What Is the .NET Framework? 4
What's in the .NET Framework? 4
Writing Applications Using the .NET Framework 5
What Is C#? 8
Applications You Can Write with C# 9
C# in this Book 10
Visual Studio 2015 10
Visual Studio Express 2015 Products 10
Solutions 11
CHAPTER 2: WRITING A C# PROGRAM 13
The Visual Studio 2015 Development Environment 14
Console Applications 17
The Solution Explorer 20
The Properties Window 21
The Error List Window 22
Desktop Applications 22
CHAPTER 3: VARIABLES AND EXPRESSIONS 29
Basic C# Syntax 30
Basic C# Console Application Structure 33
Variables 34
Simple Types 34
Variable Naming 39
Literal Values 39
Expressions 42
Mathematical Operators 42
Assignment Operators 47
Operator Precedence 48
Namespaces 49
CHAPTER 4: FLOW CONTROL 53
Boolean Logic 54
Boolean Bitwise and Assignment Operators 56
Operator Precedence Updated 58
Branching 59
The Ternary Operator 59
The if Statement 59
The switch Statement 63
Looping 66
do Loops 66
while Loops 69
for Loops 71
Interrupting Loops 72
Infinite Loops 73
CHAPTER 5: MORE ABOUT VARIABLES 77
Type Conversion 78
Implicit Conversions 78
Explicit Conversions 80
Explicit Conversions Using the Convert Commands 83
Complex Variable Types 85
Enumerations 85
Structs 89
Arrays 92
String Manipulation 99
CHAPTER 6: FUNCTIONS 107
Defining and Using Functions 108
Return Values 110
Parameters 112
Variable Scope 119
Variable Scope in Other Structures 122
Parameters and Return Values versus Global Data 123
The Main() Function 125
Struct Functions 127
Overloading Functions 128
Using Delegates 130
CHAPTER 7: DEBUGGING AND ERROR HANDLING 135
Debugging in Visual Studio 136
Debugging in Nonbreak (Normal) Mode 136
Debugging in Break Mode 144
Error Handling 153
trycatchfinally 153
Listing and Configuring Exceptions 160
CHAPTER 8: INTRODUCTION TO OBJECT-ORIENTED PROGRAMMING 163
What Is Object-Oriented Programming? 164
What Is an Object? 165
Everything's an Object 168
The Life Cycle of an Object 168
Static and Instance Class Members 169
OOP Techniques 170
Interfaces 171
Inheritance 172
Polymorphism 175
Relationships between Objects 177
Operator Overloading 179
Events 180
Reference Types versus Value Types 180
OOP in Desktop Applications 180
CHAPTER 9: DEFINING CLASSES 187
Class Definitions in C# 188
Interface Definitions 190
System.Object 193
Constructors and Destructors 195
Constructor Execution Sequence 196
OOP Tools in Visual Studio 200
The Class View Window 200
The Object Browser 202
Adding Classes 203
Class Diagrams 204
Class Library Projects 206
Interfaces versus Abstract Classes 209
Struct Types 212
Shallow Copying versus Deep Copying 214
CHAPTER 10: DEFINING CLASS MEMBERS 217
Member Definitions 218
Defining Fields 218
Defining Method...