Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
The C# Workshop
The C# Workshop

The C# Workshop: Kickstart your career as a software developer with C#

Arrow left icon
Profile Icon Jason Hales Profile Icon Almantas Karpavicius Profile Icon Mateus Viegas
Arrow right icon
$36.99 $41.99
Full star icon Full star icon Full star icon Full star icon Half star icon 4.5 (14 Ratings)
eBook Sep 2022 780 pages 1st Edition
eBook
$36.99 $41.99
Paperback
$51.99
Subscription
Free Trial
Renews at $19.99p/m
Arrow left icon
Profile Icon Jason Hales Profile Icon Almantas Karpavicius Profile Icon Mateus Viegas
Arrow right icon
$36.99 $41.99
Full star icon Full star icon Full star icon Full star icon Half star icon 4.5 (14 Ratings)
eBook Sep 2022 780 pages 1st Edition
eBook
$36.99 $41.99
Paperback
$51.99
Subscription
Free Trial
Renews at $19.99p/m
eBook
$36.99 $41.99
Paperback
$51.99
Subscription
Free Trial
Renews at $19.99p/m

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

The C# Workshop

2. Building Quality Object-Oriented Code

Overview

In this chapter, you will learn how to simplify complex logic using Object-Oriented Programming (OOP). You will start by creating classes and objects, before exploring the four pillars of OOP. You will then learn about some of the best practices in coding, known as the SOLID principles, and see how you can use C# 10 features to write effective code guided by these principles. By the end of this chapter, you will be able to write clean code using object-oriented design with C#.

Introduction

How do people write software that is still maintainable even after many decades? What is the best way to model software around real-world concepts? The answer to both questions is Object Oriented Programming (OOP). OOP is a widely used paradigm in professional programming and is especially useful in enterprise settings.

OOP can be thought of as a bridge that connects real-world concepts and source code. A cat, for example, has certain defining properties, such as age, fur color, eye color, and name. The weather can be described using factors such as temperature and humidity. Both of these are real-world concepts that humans have identified and defined over time. In OOP, classes are what help in defining the logic of a program. When assigning concrete values to the properties of these classes, the result is an object. For example, using OOP, you can define a class for representing a room in a house, and then assign values to its properties (color and area) to create an object of that class.

In Chapter 1, Hello C#, you learned how to use C# to write basic programs. In this chapter, you will see how you can design your code by implementing OOP concepts and using C# at its best.

Classes and Objects

A class is like a blueprint that describes a concept. An object, on the other hand, is the result you get after the application of this blueprint. For example, weather can be a class, and 25 degrees and cloudless could refer to an object of this class. Similarly, you can have a class named Dog, while a four-year-old Spaniel can represent an object of the Dog class.

Declaring a class in C# is simple. It starts with the class keyword, followed by the class name and a pair of curly braces. To define a class named Dog, you can write the following code:

class Dog
{
}

Right now, this class is just an empty skeleton. However, it can still be used to create objects by using the new keyword, as follows:

Dog dog = new Dog();

This creates an object named dog. Currently, the object is an empty shell, as it lacks properties. You will see in an upcoming section how to define properties for classes, but first, you will explore constructors.

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Gain a solid foundation in C# and focus on coding real-world applications
  • Learn how to write clean, effective code and think like a C# developer
  • Build your experience and confidence with hands-on exercises and activities

Description

C# is a powerful, versatile language that can unlock a variety of career paths. But, as with any programming language, learning C# can be a challenging process. With a wide range of different resources available, it’s difficult to know where to start. That's where The C# Workshop comes in. Written and reviewed by industry experts, it provides a fast-paced, supportive learning experience that will quickly get you writing C# code and building applications. Unlike other software development books that focus on dry, technical explanations of the underlying theory, this Workshop cuts through the noise and uses engaging examples to help you understand how each concept is applied in the real world. As you work through the book, you'll tackle realistic exercises that simulate the type of problems that software developers work on every day. These mini-projects include building a random-number guessing game, using the publisher-subscriber model to design a web file downloader, creating a to-do list using Razor Pages, generating images from the Fibonacci sequence using async/await tasks, and developing a temperature unit conversion app which you will then deploy to a production server. By the end of this book, you'll have the knowledge, skills, and confidence to advance your career and tackle your own ambitious projects with C#.

Who is this book for?

This book is for aspiring C# developers. It is recommended that you already have a basic understanding of core programming concepts before you start. Prior experience of another programming language would be beneficial, though it is not absolutely necessary.

What you will learn

  • Understand the fundamentals of programming with C# 10 and .NET 6
  • Build your familiarity with .NET CLI and Visual Studio Code
  • Master the fundamentals of object-oriented programming (OOP)
  • Understand and implement concurrency to write more efficient code
  • Create a database and handle data using C#, SQL, and Entity Framework
  • Build web applications using the ASP.NET framework
  • Run automated unit tests with NUnit to validate your code
  • Use principles including SOLID, KISS, ACID, DRY, and design patterns

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Sep 27, 2022
Length: 780 pages
Edition : 1st
Language : English
ISBN-13 : 9781800568501
Category :
Languages :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : Sep 27, 2022
Length: 780 pages
Edition : 1st
Language : English
ISBN-13 : 9781800568501
Category :
Languages :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total $ 151.97
The C# Workshop
$51.99
C# 11 and .NET 7 – Modern Cross-Platform Development Fundamentals
$49.99
Apps and Services with .NET 7
$49.99
Total $ 151.97 Stars icon

Table of Contents

9 Chapters
1. Hello C# Chevron down icon Chevron up icon
2. Building Quality Object-Oriented Code Chevron down icon Chevron up icon
3. Delegates, Events, and Lambdas Chevron down icon Chevron up icon
4. Data Structures and LINQ Chevron down icon Chevron up icon
5. Concurrency: Multithreading Parallel and Async Code Chevron down icon Chevron up icon
6. Entity Framework with SQL Server Chevron down icon Chevron up icon
7. Creating Modern Web Applications with ASP.NET Chevron down icon Chevron up icon
8. Creating and Using Web API Clients Chevron down icon Chevron up icon
9. Creating API Services Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Full star icon Half star icon 4.5
(14 Ratings)
5 star 78.6%
4 star 7.1%
3 star 7.1%
2 star 0%
1 star 7.1%
Filter icon Filter
Top Reviews

Filter reviews by




Anthony Grippi Oct 26, 2022
Full star icon Full star icon Full star icon Full star icon Full star icon 5
First of all, I never write reviews. A product has to be pretty outstanding for me to take my time to write something, and for me to take up your time.I am a full-time student studying Computer Scince. I also work full time as a CRM Engineer. I have read this book and I am happy to say that it is really well done, but most importantly, it was a huge help to me in terms of my understanding of C# code!It is simply written but that is what is so great about it. The author goes through everything that my professors at university go through but in simpler terms. The author covers the basics thoroughly, and in roughly the same order as we are learning at school, as he mirrors everything that all of our professors/instructors/lab assistants are saying so it’s been good to read the information again, only differently.We all know there are thousands of books out there and not all of them are helpful, and in fact, make things worse by confusing the reader. This book reads like normal speech whereas most books on programming are like reading Greek, or some strange alien language. I often think to myself, "as if learning to code isn't confusing enough, and now I am going to read this textbook the size of New York and then be even more confused..." - well this book is not like that at all. It is thoughtfully written and the author has done a wonderful job of writing as if it is a conversation between two friends. So far, it’s been extremely helpful in sorting out some of my coding confusion, and I am always happy to share effective tools with others
Amazon Verified review Amazon
Peter Bull Oct 30, 2022
Full star icon Full star icon Full star icon Full star icon Full star icon 5
The C# Workshop is a great introduction to C# along with covering more intermediate and advanced topics. It gives you everything you need to get you started quickly with clear instructions on how to get everything set up and the exercises are easy to follow and can get instant results. Concepts are introduced at a good pace with well thought out examples with great attention to detail including pointing out expected differences in output depending on the reader’s location or language as well as considering the differences when creating new projects.The C# Workshop also helps break down the concepts of building object-oriented code with clear explanations about each concept with snippets that help explain them well with each exercise making it easier to understand as you progress through the concepts. More advanced concepts are handled well with explanations building on previous concepts to help advance through the topics being discussed from long held features to the latest functionality in C#.The C# Workshop will take you through beginner, intermediate and advanced topics but with a good foundation at each step it never seems like there’s too big a leap and exercises, examples and explanations at each stage help make sure you don’t get lost or confused along the way and help understand fundamental concepts along with creating modern applications, using a variety of features from PostgreSQL and Entity Framework to Web Applications with Razor and ASP.NET and get something working that you can learn from each step of the way.The C# Workshop is a great way to not only get your first taste of C# but to help advance learning the language with more intermediate and advanced topics, with exercises and examples to help understand throughout the book that even existing C# developers will find useful to add to their existing knowledge or just help make more sense of the functionality and features they use. I’d certainly recommend this book to anyone who wants to kickstart learning or to add to any knowledge for C#!
Amazon Verified review Amazon
Halbot Oct 31, 2022
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Starting from the basics, but also importantly covers how to write quality code using OOO principles. Real world examples are useful and make it more approachable. It would have been nice to include Blazor as well as razor, but it covers the core aspects of C# well and in a clear manner.Overall a great resource and I would recommend to anyone starting out in C# programming.
Amazon Verified review Amazon
Craig Feb 17, 2023
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Picked this book up to start my learning journey with C# and was very happy with it! This is the book you want if you're new to C#! I think the first chapters do a very good job in ramping someone new to C# up by slowly going over small and simple to understand examples. This is a trend that is followed in the book up to the very end even with some of the more advanced concepts -- Start with a small example of a concept and slowly build on it by adding more in-depth, more difficult concepts.Even being experienced with something like OOP I found nuggets of information useful in that chapter that made me wanna read the entire chapter without skipping any parts. I found the entire book so engaging I was never bored enough to be tempted to skip any parts. Each chapter does an amazing job of keeping the reader engaged.Data structures and LINQ are thoroughly explained in depth in an easy to understand way. The best explanation of LINQ is found within this book. Provided with powerful LINQ examples that will make your life writing C# much easier! More small simple to understand examples that are slowly built on makes learning and putting these idea into practice for someone new or experienced is a walk in the park.Often I find myself needing to re-reading chapters from tech books to better understand the topic at hand using my first pass on the chapter as a base foundation to build my understanding on. I don't think I did this once in the entire book! It is that well explained while being engaging if you're doing the coding sections in parallel with the book while you read! You feel your understand growing with each page turn and before you know it you're off and running with the more advanced topics like Entity Framework, Creating a web app using ASP.NET or creating your own Web API.If you're looking to start building with C# quickly while having a great understanding of your code I would highly recommend this read! Packt really hit the mark on this book! My hats off to the authors as well! Thank you, Jason Hales, Almantas Karpavicius, and Mateus Viegas! Fantastic read!
Amazon Verified review Amazon
Richard B Apr 08, 2023
Full star icon Full star icon Full star icon Full star icon Full star icon 5
These authors were meticulous and caring enough to include and speak to assumptions that other books and online courses seem to ignore. I recommend it as a first choice beginners and as a "a-ha" supplement for intermediates.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.