Our Ironclad Guarantee
You must be satisfied. Try our print books for 30 days or our eBooks for 14 days. If they aren't the best you've ever used, you can return the books or cancel the eBooks for a prompt refund. No questions asked!
This is the latest edition of our best-selling book that’s been training developers in C# since 2004. It focuses on how to develop professional Windows Forms applications with C#. But along the way, it teaches you the C# coding skills that you’ll use to develop any C# application, including desktop, web, or mobile apps.
Go to our instructor’s site to learn more about this book and its instructor’s materials.
Best C# book ever. Murach manuals are precise and to the point, with lots and lots of examples. Highly recommended for beginners."
This book is for anyone who wants to learn the C# language. It works if…
This is a great first book in C#, whether you’re a programming novice or an experienced programmer. Here are 5 reasons why that’s true.
This book starts you off using all the best features of Visual Studio so you can begin productive work almost immediately. In fact, it has you create a simple business application in chapters 2 and 3 so you can see right away how C#, Visual Studio, and .NET work together.
This book takes the mystery our of object-oriented programming (OOP) by showing how to work with realistic business objects such as products, customers, and invoices. This allows you to use OOP to create multi-tiered applications like the ones created by professional developers.
Learning to use C# classes and OOP techniques isn’t enough. You also have to know how to code for the tasks that are required in most business applications.
That’s why this book builds on your skills in incremental steps to teach you how to validate data; handle numeric, date, and string data; work with loops, arrays, and collections; code methods and event handlers; handle exceptions; and work with files and databases.
Most business applications use a database. That’s why this book teaches you how to create applications that use EF Core or ADO.NET to work with a database. And it shows how LINQ allows you to use C# to query almost any data structure, not just databases.
This book presents complete, non-trivial applications that illustrate what you need to know on the job. Studying applications like these is the key to mastering C# development.
The skills for developing Windows Forms applications using C# haven’t changed much since the previous edition. Still, this book has been thoroughly updated to include coverage of the most helpful new features from the latest releases of C#, .NET, and Visual Studio.
To develop the Windows Forms applications presented in this book, you need the following:
Although .NET is cross-platform, you can’t use macOS or Linux to develop Windows Forms applications like the ones shown in this book. You have to have a Windows system.
The Community edition of Visual Studio can be downloaded for free from Microsoft’s website. When you install it, you can also install all of the components that you need to work with this book, including:
Appendix A provides detailed installation instructions.
If you already have another edition of Visual Studio installed on your system, such as the Professional edition, you can use that if you prefer. Everything in our book will still work for you.
"Best C# book ever. Murach manuals are precise and to the point, with lots and lots of examples. Highly recommended for beginners."
- Posted at an online bookseller
"Murach has yet again hit a home run! This book is laid out in such a way where the theory is on the left page and the ‘Cliff Notes’ version of the content is on the right side. It gets you from zero to Jr Dev knowledge in no time. After the fact, you can always use that right page as a great reference whilst in the middle of a project. Bravo again, guys."
- Brian Knight, Founder, Pragmatic Works, Florida
"A notable feature of the book is that everything is done as a ‘How to,’ which is great when you are learning. This is the typical Murach approach to books, making them not just useful for learning but also as big cookbooks."
- David Bolton, Past Host of C/C++/C# for About.com (now hosted at ThoughtCo.com)
“This is my first Murach book. For starters, I really like the format. It made it easy to understand the material as I was going through it. And speaking of material in the book, it covers a lot. I feel it will make a good reference for any future projects I may encounter.”
- Posted at an online bookseller
"Just trying to learn a development language can be daunting, and you can spend hours trying to find the answer to rather straightforward questions, like working with arrays. This book brings it all together in a comprehensive manner that is easy to understand and follow."
- Hal Hayes, Capital Area .NET User Group
“I am pretty critical of most authors, because they write fluff...and they present very little code. Not Murachs's. Most of the C# books I have purchased received a 3/5 star rating. Murach's is 5/5. I would buy this again.”
- Posted at an online bookseller
"Murach’s books have always impressed me, and Murach’s C# is no exception. It is an excellent source for those looking to learn C#, and there is much included that will benefit existing C# programmers as well. The examples and projects are relevant in a business setting and are complete. It is well worth adding this book to your programming reference collection."
- Jamie McMahon, DreamInCode.net
View the table of contents for this book in a PDF: Table of Contents (PDF)
Click on any chapter title to display or hide its content.
Platforms for .NET applications
Visual Studio and the .NET programming languages
The .NET Framework and .NET Core
The Visual Studio IDE
How a C# application is compiled and run
How to start Visual Studio
How to open or close an existing project
How to use the Form Designer
How to use the Code Editor
How to use the Solution Explorer
How to work with Visual Studio’s windows
How to change the .NET version used by a project
How to build a project
How to run a project
How to create a new project
How to configure a new Windows Forms app
The design of the Invoice Total form
How to add controls to a form
How to set properties
Common properties for forms and controls
How to add navigation features
The property settings for the Invoice Total form
How to rename the files of a project
How to save the files of a project
Introduction to object-oriented programming
How to refer to properties, methods, and events
How an application responds to events
How to create an event handler for the default event of a form or control
How to delete an event handler
How IntelliSense helps you enter the code for a form
The event handlers for the Invoice Total form
How to detect and correct syntax errors
How to code with a readable style
How to code comments
How to work with the Text Editor toolbar
How to collapse or expand blocks of code
How to use code snippets
How to refactor code
How to get help information
How to run a project
How to test a project
How to debug runtime errors
The built-in value types
How to declare and initialize variables
How to declare and initialize constants
How to code arithmetic expressions
How to code assignment statements
How to work with the order of precedence
How to use casting
How to use the Math class
How to generate random numbers
How to declare and initialize a string
How to join and append strings
How to include special characters in strings
How to code raw string literals
The .NET structures and classes that define data types
How to use methods to convert data types
How to use methods to convert numbers to formatted strings
How to work with scope
How to declare and use enumerations
How to work with nullable value types and the null-coalescing operators
How to work with nullable reference types
The basic Invoice Total app
The enhanced Invoice Total app
How to use the relational operators
How to use the logical operators
How to code if-else statements
How to code switch statements
How to code switch expressions
How to use pattern matching
How to use the conditional operator
An enhanced version of the Invoice Total app
How to code while and do-while loops
How to code for loops
Loops that use break and continue statements
Debugging techniques for programs with loops
The design and property settings for the form
The code for the form
How to code methods
How to call methods
How to use optional parameters
How to use named arguments
How to code expression-bodied methods
How to use refactoring to create a new method and its calling statement
When and how to pass arguments by reference and by value
How to create tuples and refer to their members
How to use a tuple as the return type for a method
How to generate an event handler for any event
How event wiring works
How to handle multiple events with one event handler
The event handlers and the CalculateFutureValue() method
Some of the generated code
How exceptions work
How to display a dialog
How to catch an exception
How to use the properties and methods of an exception
How to catch specific types of exceptions
How to throw an exception
The Future Value app with exception handling
How to validate a single entry
How to code generic methods for data validation
How to validate multiple entries
The dialogs
The code
How to create an array
How to assign values to the elements of an array
How to work with arrays
How to use foreach loops to work with arrays
How to create a rectangular array
How to assign values to a rectangular array
How to work with rectangular arrays
How to use the Array class
How to refer to and copy arrays
How to code methods that work with arrays
How to use the null-conditional operator
More ways to refer to array elements
How to work with list patterns
Commonly used collection classes
Typed vs. untyped collections
How to work with a list
How to work with a sorted list
How to work with queues and stacks
How to work with an array list
How to create a DateTime value
How to get the current date and time
How to format DateTime values
How to get information about dates and times
How to perform operations on dates and times
The members of the String class
Code examples that work with strings
More code examples that work with strings
How to use interpolated strings for join operations
How to use the Parse() and TryParse() methods to validate numeric entries
How to use the StringBuilder class
How to format numbers
How to format dates and times
How to use interpolated strings for formatting
Five more types of controls
How to work with combo boxes and list boxes
How to work with check boxes and radio buttons
How to work with group boxes
How to use Tab Order view to set the tab order
How to get the information you need for using a control
How to add a form to a project
The code that’s generated for a new form
How to work with global using directives
How to rename a form
How to display the first form of an app
How to display a form as a dialog
How to pass data between a form and a custom dialog
How to display a dialog and get the user response
How to use the FormClosing event
The operation
The property settings
The code for the Customer form
The code for the Payment form
How to work in break mode
How to work with data tips
How to use the Hot Reload feature
How to use breakpoints
How to control the execution of an app
How to use the Locals window to monitor variables
How to use the Autos window to monitor variables
How to use Watch windows to monitor expressions
How to use the Immediate window to execute commands
How to use the Output window to view project information
How to write data to the Output window
How to use the Visualizer to view strings and collections
How classes can be used to structure an app
How to define a class
How to create objects from a class
How to add a class file to a project
How to code properties
How to code methods
How to code constructors
How to code static members
The operation of the Product Maintenance app
The classes used by the Product Maintenance app
The code for the Product Maintenance app
How to code properties with fields
How to code overloaded methods and constructors
How to code required properties
How to use property patterns
How to create a structure
How to use a structure
How to create and use a record
How to create and use a record struct
When to use classes, structures, records, and record structs
The Product Maintenance app updated to use a record
The code for a simple ProductList class
The specifications for the enhanced ProductList class
How to create an indexer
How to code expression-bodied indexers and accessors
How to throw an argument exception
How to define and use a delegate
How to define and use events
How to use anonymous methods and lambda expressions with delegates and events
An introduction to operator overloading
How to overload arithmetic operators
How to overload relational operators
The code for the ProductList class
The code for the Product Maintenance form
How inheritance works
How .NET uses inheritance
Methods inherited from the System.Object class
How to use inheritance in your apps
How to create a base class
How to create a subclass
How polymorphism works
The operation of the Product Maintenance app
The code for the Product, Book, and Software classes
The code for the ProductList class
The code for the Product Maintenance form
The code for the New Product form
How to use the Type class to get information about an object’s type
How to use casting with inheritance
How to work with abstract classes
How to work with sealed classes
An introduction to interfaces
Some of the interfaces defined by .NET
How to create an interface
How to work with default methods
How to work with static methods and fields
How to implement an interface
A Product class that implements the ICloneable interface
How to use an interface as a parameter
How to code a class that defines a generic collection
Some of the generic interfaces defined by .NET
How to implement the IComparable interface
How to use constraints
How to implement the IEnumerable interface
How to code an interface that uses generics
How to code multiple classes in a single file
How to split a single class across multiple files
How to work with namespaces
How to work with file scoped namespaces
How to add XML documentation to a class
How to view the XML documentation
How class libraries work
How to create a class library project
How to add a reference to a class library
How to use the classes in a class library
How unit testing works
How to create a unit test project
How to code unit tests
How to run unit tests
The classes for managing directories, files, and paths
How files and streams work
How to use the FileStream class
How to use the exception classes for file I/O
How to write a text file
How to read a text file
How to use the using statement and the using declaration
A class that works with a text file
How to write a binary file
How to read a binary file
A class that works with a binary file
How LINQ is implemented
Advantages of using LINQ
The three stages of a query operation
How to identify the data source for a query
How to filter the results of a query
How to sort the results of a query
How to select fields from a query
How to join data from two or more data sources
How to use the LINQ methods for query operations
How to use additional LINQ methods
The user interface
The code for the form
The hardware components of a client/server system
The software components of a client/server system
How a table is organized
How the tables in a database are related
How the columns in a table are defined
The design of the MMABooks database
How to query a single table
How to join data from two or more tables
How to add, update, and delete data in a table
How Entity Framework Core works
How to add EF Core to your project
How to generate DB context and entity classes
The data model for the MMABooks database
The code for the DB context class
The code for the Customer entity class
How to modify the generated code
How to retrieve data
How to load related objects
How to insert, update, and delete data
How to handle database exceptions
How concurrency affects insert, update, and delete operations
How to check for concurrency conflicts
How to handle concurrency exceptions
How to bind controls to a collection
How to bind controls to the results of a query
A simple data access class
A data access class that handles exceptions
The user interface
The code for the Customer Maintenance form
The code for the Add/Modify Customer form
The .NET data provider for SQL Server
How the connection, command, and data reader objects work
How to create and work with connections
How to create and work with commands
How to use parameters in SQL statements
How to create and work with the parameters for a command
How to create and work with a data reader
How to execute queries that return a single value
How to execute action queries
The user interface
The code for the data access class
An introduction to the DataGridView control
How to set the functions provided by a DataGridView control
How to bind to a data source
How to code a method in a data access class that gets selected columns
How to format the columns
How to format the headers and alternating rows
How to add and remove columns
How to work with the object that’s passed to an event handler
The user interface
The code for the Product Maintenance form
The user interface for a form that provides for paging
The code that implements the paging
The user interface for a Master/Detail form
The code for the DTOs, data access class, and form
How to install the files for this book
How to install Visual Studio
How to set up your system to use the database
This chapter shows you how to use Visual Studio to design a Windows form that displays the discount amount and final total for an invoice, based on user input and a fixed discount rate.
Chapter 2 PDF Download Now
This chapter teaches you how to enter the C# code for the Windows form in chapter 2 so the interface works the way you want it to. It also gets you started with practical debugging techniques.
Chapter 3 PDF Download Now
Contains step-by-step instructions for installing all the software you need to work through the examples and exercises presented in this book.
Appendix A PDF Download Now
This download includes:
The appendix in the book shows how to install and use these files.
Zip file for any system Download Now
To view the "Frequently Asked Questions" for this book in a PDF, just click on this link: View the questions
Then, if you have any questions that aren't answered here, please email us. Thanks!
To view the corrections for this book in a PDF, just click on this link: View the corrections
Then, if you find any other errors, please email us so we can correct them in the next printing of the book. Thank you!
For orders and customer service:
1-800-221-5528
Weekdays, 8 to 4 Pacific Time
If you're a college instructor who would like to consider a book for a course, please visit our website for instructors to learn how to get a complimentary review copy and the full set of instructional materials.