Gerard Byrne

Target C#

Simple Hands-On Programming with Visual Studio 2022

Gerard Byrne
Belfast, Ireland
ISBN 978-1-4842-8618-0e-ISBN 978-1-4842-8619-7
© Gerard Byrne 2022
This work is subject to copyright. All rights are solely and exclusively licensed by the Publisher, whether the whole or part of the material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation, broadcasting, reproduction on microfilms or in any other physical way, and transmission or information storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now known or hereafter developed.
The use of general descriptive names, registered names, trademarks, service marks, etc. in this publication does not imply, even in the absence of a specific statement, that such names are exempt from the relevant protective laws and regulations and therefore free for general use.
The publisher, the authors, and the editors are safe to assume that the advice and information in this book are believed to be true and accurate at the date of publication. Neither the publisher nor the authors or the editors give a warranty, expressed or implied, with respect to the material contained herein or for any errors or omissions that may have been made. The publisher remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

This Apress imprint is published by the registered company APress Media, LLC, part of Springer Nature.

The registered company address is: 1 New York Plaza, New York, NY 10004, U.S.A.

My book is dedicated to Maura, Ryan, and Peter.

Introduction

The chapters in this book will cover coding in C# using the Visual Studio Integrated Development Environment (IDE) from Microsoft. Other Integrated Development Environments exist, such as Visual Studio Code, and the code from the applications in the chapters will work within any Integrated Development Environment capable of running C# code. While the step-by-step instructions and screenshots in the book are based around the Visual Studio Integrated Development Environment, they can still be used by those preferring a different Integrated Development Environment.

The first two chapters of the book introduce us to the .NET framework, the Visual Studio Integrated Development Environment, and how to complete the required software installation. With the necessary tools installed, we are then introduced to what a computer program is, before we start to write our own computer programs. We then begin to cover the core concepts needed when developing C# code and which can be applied to other programming languages. We cover a wide range of core programming concepts, including data types, selection, iteration, arrays, methods, classes and objects, serialization, file handling, string handling, and exception handling. Studying these chapters is more than enough to allow us to develop applications that emulate commercial application code.

All examples in the chapters are fully commented to ensure we can understand the code and to enhance our knowledge of the C# programming language. Reading the comments within the code examples is essential; they are an integral part of the book and will enhance our understanding of C# and will help explain why the code does something or what the code is doing.
  • After we have completed the core chapters, Chapters 1 13, we continue our C# journey by looking at more advanced topics starting with interfaces and abstract classes, which are essential concepts for all developers. In later chapters we work with classes and “lightweight” classes such as structs. We also look at more complex concepts when we study delegates in Chapter 21, and this leads us naturally into Chapter 22 on events and Chapter 23 on generics. We also study chapters involving the common concepts of string handling and file handling where we see the importance of exception handling, which we also study in Chapter 17. Having gained lots of coding experience and having read and applied the core and advanced C# concepts, we look at common programming routines and use C# to code them. The routines include linear search, binary search, bubble sort, and insertion sort.

  • The book then completes with labs, additional exercises, for the majority of the programming chapters we have covered. Each exercise in a lab is supported with a working solution just in case we have difficulty completing any of the lab exercises.

  • The book is ideal for beginners, those refreshing their C# skills, or those moving from another programming language. It is ideally suited for students studying programming at high school or at university and is an excellent resource for teachers who deliver programming lessons. The book offers detailed explanations and the code has excellent comments to support learning. By using clean code with proper naming, the code is intuitive to read and understand.

  • Reading the book is one thing, but actually coding the examples using an Integrated Development Environment is the most important thing if we wish to get the best understanding of the C# language. Hands-on experience while reading this book is the key to success.

  • We should think about two things before we begin our programming journey through this book:

“Life begins at the edge of our comfort zone” and

“Think about now, and believe.”

Often the thought of getting started can make us “frightened” and “uncomfortable.” We need to believe in ourselves and understand that while there will be “lows” during the learning, we will survive them and move to the inevitable “highs.”

Programming can be rewarding and thankfully it is within our ability to write code. The chapters in this book will help us to learn about coding, teach us how to code, and make us realize that it is indeed realistic for us to program in the C# language.

As we start learning C#, it is important to realize that the target of being able to write computer applications in C# will seem large as there is a lot to learn, but we should take comfort in the fact that as we complete each chapter and gain experience in writing our applications, the target gets closer and the amount of learning gets smaller. In essence, as we move along our learning pathway, we gain competence in concepts that will be continually used in our application code.

Acknowledgments

Writing a book is a rewarding undertaking, but it requires time, effort, and patience, patience from those around you in your life.

So I have to start by thanking my wife, Maura, and my sons, Ryan and Peter, for “facilitating” me as I worked over many hours, days, weeks, and months to write this programming book.

I also wish to thank my great friend David from whom I have learned so much and with whom I have had the pleasure of delivering many enjoyable programming courses. If I need coding inspiration and humor, I always know to talk to David.

Finally, I want to say thank you to Joan Murray from Apress for helping me get the book proposal approved and to the whole Apress team who have worked with me and worked behind the scenes to get the book published. I am grateful for your help and fully understand that this book has so much of your effort within it.

Table of Contents
Index 1059
About the Author
Gerard Byrne

A photo of Gerard Byrne.

is a senior technical trainer for a US-based Forbes 100 company. He works to upskill and reskill software engineers who develop business-critical software applications. He also helps refine the programming skills of “returners” to the workforce and introduces new graduates to the application of software development within the commercial environment.

Gerard’s subject expertise has been developed over a multidecade career as a teacher, lecturer, and technical trainer in a corporate technology environment. He has delivered a range of courses across computer languages and frameworks and understands how to teach skills and impart knowledge to a range of learners. He has taught people in the use of legacy technologies such as COBOL and JCL and more “modern” technologies and frameworks such as C#, Java, Spring, Android, JavaScript, Node, HTML, CSS, Bootstrap, React, Python, and Test-Driven Development (TDD).

Gerard has mastered how to teach difficult concepts in a simple way that makes learning accessible and enjoyable. The content of his notes, labs, and other materials follows the simple philosophy of keeping it simple while making the instructions detailed. He is passionate about software development and believes we can all learn to write code if we are patient and understand the basic coding concepts.

 
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.137.199.182