9,99 €
Do you want to learn the basic techniques for programming in C# 10 and gain enough knowledge to start creating your own applications? Do you want to know how .NET 6.0, the compiler, Garbage Collector and Visual Studio 2022 work? Do you want to start laying the foundation for your new profession in software development? Or do you simply need to pass college exams in computer science or computer engineering and need an easy-to-read and effective text to understand object-oriented programming? This is the book for you! This guide, however, is also useful as a reference manual to keep close to the workstation, for the already experienced developer who needs to consult it from time to time.
Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:
SUMMARY
SUMMARY
INDEX OF TOPICS
INTRODUCTION
IN THE SAME SERIES
1 – FIRST CONTACT
2 – FROM .NET FRAMEWORK TO .NET 6
3 – INTEGRATED DEVELOPMENT ENVIRONMENT (IDE)
4 – THE MAIN VISUAL STUDIO WINDOWS
5 – VISUAL STUDIO MENUS
6 – TOOLBARS
7 – WRITE THE CODE
8 – CODE SNIPPETS
9 – VARIABLES AND CONSTANTS
10 – SCOPE OF VISIBILITY
11 – CONVERSIONS BETWEEN DATA TYPES
12 – OPERATORS
13 – DATA TYPES
14 – ARRAY
15 – ORGANIZE THE CODE
16 – THE LANGUAGE
17 – STRINGS, STRINGS EVERYWHERE!
18 – ERRARE UMANUM EST
19 – WHAT OOP MEANS?
20 – THE THREE PILLARS OF OOP
APP. A – DATA TYPES
APP. B – CORRESPONDENCES BETWEEN DATA TYPES
BIOGRAPHY
Mario De Ghetto
INDEX OF TOPICS
SUMMARY
INDEX OF TOPICS
INTRODUCTION
VISUAL STUDIO 2022
WHO SHOULD READ THIS BOOK?
WARNINGS, FEEDBACK AND SAMPLE CODE
USEFUL RESOURCES
ACKNOWLEDGEMENTS
IN THE SAME SERIES
1 – FIRST CONTACT
WHAT IS VISUAL STUDIO 2022 FOR?
VISUAL STUDIO 2022 MOVES FROM 32-BIT TO 64-BIT
SUPPORTED LANGUAGES
PROGRAMMING PARADIGMS
IMPERATIVE AND DECLARATIVE PROGRAMMING
EVENT-ORIENTED PROGRAMMING
FUNCTIONAL PROGRAMMING
OBJECT-ORIENTED PROGRAMMING (OOP)
THE FUNDAMENTAL CONCEPTS OF OBJECT-ORIENTED PROGRAMMING
INHERITANCE
ENCAPSULATION
POLYMORPHISM
FIRST EASY EXAMPLES IN C#
C# INTERACTIVE WINDOW
CONCLUSIONS
2 – FROM .NET FRAMEWORK TO .NET 6
.NET FRAMEWORK
FROM .NET FRAMEWORK TO .NET 6
THE EXCEPTIONS THAT CONFIRM THE RULE
MULTITHREADING OR PARALLEL PROGRAMMING
CLR AND CLASS LIBRARY
THE COMMON LANGUAGE RUNTIME (CLR)
HEAP AND STACK MEMORY
BASE CLASS LIBRARY (BCL)
STRONG TYPING AND THE COMMON TYPE SYSTEM
THE COMMON LANGUAGE SPECIFICATION
MEMORY MANAGEMENT
DESTRUCTION OF OBJECTS IN MEMORY
COM REFERENCE COUNTER
.NET GARBAGE COLLECTOR
ASSEMBLY
NAMESPACES OF .NET
CONCLUSIONS
3 – INTEGRATED DEVELOPMENT ENVIRONMENT (IDE)
A DEVELOPMENT ENVIRONMENT FOR ALL SEASONS
ALTERNATIVES TO VISUAL STUDIO
VISUAL STUDIO FEATURES
START WINDOW
OPEN RECENT
GET STARTED
CHANGING THE STARTUP MODE
CREATE CUSTOM TEMPLATES
THEME CUSTOMIZATION OF VISUAL STUDIO
CONCLUSIONS
4 – THE MAIN VISUAL STUDIO WINDOWS
WINDOWS OF A SOLUTION
SOLUTION EXPLORER
OPEN FOLDER IN FILE EXPLORER
SHOW ALL FILES
PROPERTIES WINDOW
TOOLBOX
GROUP OF CARDS
COLORING IN THE CARD GROUP
TASK LIST
ADD NEW TOKENS
CONCLUSIONS
5 – VISUAL STUDIO MENUS
WHAT ARE MENUS
MENU VARIABILITY
LET'S EXPLORE THE MENUS
FILE MENU
EDIT MENU
MENU VIEW
GIT MENU
PROJECT MENU
BUILD MENU
DEBUG MENU
MENU DESIGN
FORMAT MENU
ARCHITECTURE MENU
TEST MENU
ANALYZE MENU
TOOLS MENU
MENU EXTENSIONS
MENU WINDOW
HELP MENU
SEARCH BOX "SEARCH"
MENU CUSTOMIZATION
CONCLUSIONS
6 – TOOLBARS
WHAT ARE TOOLBARS
STANDARD TOOLBAR
NAVIGATION BUTTONS
NEW PROJECT
OPEN FILE
SAVE <ITEM>
SAVE ALL
UNDO AND REDO
SOLUTION CONFIGURATIONS
SOLUTION PLATFORM
START
FIND IN FILES
START WINDOW
STANDARD TOOLBAR OPTIONS
CONCLUSIONS
7 – WRITE THE CODE
THE CODE EDITOR
CREATE A NEW PROJECT
OPEN THE CODE EDITOR WINDOW
NEW C# 10 CODE STYLE
PREVIOUS CODE STYLE
THE SAMPLE APPLICATION
CODE ZOOM
STRUCTURE EXPANSION/COMPRESSION
THE CONTEXTUAL MENU
CODE COLORING
VERTICAL SCROLL BAR MAP MODE
ACTIVATE MAP MODE
SUMMARY OF CODE EDITOR FEATURES
CONCLUSIONS
8 – CODE SNIPPETS
CODE SNIPPETS COLLECTION
INSERTING A FRAGMENT
SHORTCUT
SAVING CODE FRAGMENTS IN THE TOOLBOX
WHERE ARE THE CODE SNIPPETS?
CONCLUSIONS
9 – VARIABLES AND CONSTANTS
INTRODUCTION
THE DATA AND INFORMATION
DATA TYPES
DECLARE A VARIABLE
VARIABLE NAMES
HUNGARIAN NOTATION
CONSTANTS
IMPLICIT STATEMENTS (VAR)
CONCLUSIONS
10 – SCOPE OF VISIBILITY
VARIABLE VISIBILITY
BLOCK SCOPE
ROUTINE SCOPE
NAMESPACE SCOPE
OBSCURING VARIABLES
ADVANTAGES OF VISIBILITY SCOPE
ACCESS MODIFIERS
CONCLUSIONS
11 – CONVERSIONS BETWEEN DATA TYPES
INTRODUCTION
LOSS OF INFORMATION
IMPLICIT CASTING
EXPLICIT CASTING
USER-DEFINED CONVERSIONS
CONVERSIONS WITH SYSTEM.CONVERT
PARSE METHOD
BOXING AND UNBOXING
CONCLUSIONS
12 – OPERATORS
REMEMBER THE OPERATIONS YOU DID IN SCHOOL?
ASSIGNMENT OPERATORS
ARITHMETIC OPERATORS
AUGMENTATION OPERATOR
DECREMENT OPERATOR
MULTIPLICATION OPERATORS AND DIVISION
REST OPERATOR (MODULE)
ADDITION AND SUBTRACTION AND SUBTRACTION
COMPOUND ASSIGNMENT OPERATORS
ORDER OF PRECEDENCE
COMPARISON OPERATORS
BOOLEAN LOGIC OPERATORS
LOGICAL NEGATION OPERATOR
LOGIC OPERATOR AND (&)
LOGICAL OPERATOR OR (|)
EXCLUSIVE OR LOGIC OPERATOR (^)
CONDITIONAL LOGICAL AND OPERATOR (&&)
CONDITIONAL LOGICAL OR OPERATOR (||)
SIMULTANEOUS USE OF SEVERAL LOGICAL OPERATORS
BIT-BY-BIT AND SCROLL OPERATORS
BIT BY BIT COMPLEMENT OPERATOR (~)
LEFT SCROLL OPERATOR (<<)
RIGHT SCROLL OPERATOR (>>)
EQUALITY AND INEQUALITY OPERATORS
EQUALITY OF VALUE TYPES
EQUALITY OF REFERENCE TYPES
INEQUALITY OPERATOR (!)
CONCLUSIONS
13 – DATA TYPES
SOME INITIAL REFERENCES
CONVENTIONS ON SIGNED AND UNSIGNED TYPES
OVERFLOW
OVERFLOW ARITHMETIC OF INTEGERS
ARITHMETIC OVERFLOW OF FLOATING POINT NUMBERS
ROUNDING ERRORS
CONVERSION OF DATA TYPES
THE CONVERT CLASS
LIMITATIONS
THE TOSTRING METHOD
ROUNDINGS AND TRUNCATIONS
GUIDE TO DATA TYPES
BOOL
BYTES
SBYTE
CHAR
STRING
SHORT
USHORT
INT
UINT
LONG
ULONG
DECIMAL
FLOAT
DOUBLE
OBJECT
STRUCTURE
SOME TYPES OF DATA OF SYSTEM.NUMERICS
BIGINTEGER
COMPLEX
THE MANAGEMENT OF DATE AND TIME VALUES
DATETIME TYPE
THE DATETIME TYPE AND DATES IN DOUBLE FORMAT
CONCLUSIONS
14 – ARRAY
WHY USE ARRAYS?
ARRAY TYPES
ONE-DIMENSIONAL ARRAYS
RECTANGULAR ARRAYS (OR REGULAR)
MULTIDIMENSIONAL ARRAYS
IRREGULAR ARRAYS (JAGGED ARRAY)
BASIC CHARACTERISTICS OF AN ARRAY
ARRAY DECLARATION
SOME EXAMPLES IN THE USE OF ARRAYS
SORTING OF A ONE-DIMENSIONAL ARRAY
EXAMINE AND MANIPULATE ARRAYS
EXAMPLE OF IRREGULAR ARRAY
CONCLUSIONS
15 – ORGANIZE THE CODE
NAMESPACES
MODIFYING A NAMESPACE NAME
NESTED NAMESPACES
CLASSES
CLASS PROPERTIES
SELF-IMPLEMENTED PROPERTIES
METHODS
SUBROUTINES
FUNCTIONS
NULLABLE OPTIONAL PARAMETERS
CONCLUSIONS
16 – THE LANGUAGE
COMMENTS
CONDITIONAL INSTRUCTIONS
IF <CONDITION>... ELSE
SWITCH INSTRUCTION
CYCLE INSTRUCTIONS
CYCLE FOR
LOOP DO... WHILE
LOOP WHILE
FOREACH CYCLE
CONTINUE
TERMINATE A PROGRAM
ENVIRONMENT.EXIT(<CODE>)
CONCLUSIONS
17 – STRINGS, STRINGS EVERYWHERE!
THE DATA TYPE SYSTEM.STRING
STRING CHAINING
ESCAPE SEQUENCES
COMPOUND FORMAT STRING
STRING INTERPOLATION
THE STRINGBUILDER CLASS
STRING LENGTH
EXTRACTION OF A PART OF A STRING
INSERTING A STRING
SUBSTITUTION OF A SUBSTRING
CHECK IF A STRING STARTS OR ENDS WITH ANOTHER STRING
CONVERTING A STRING TO UPPER- AND LOWER-CASE CHARACTERS
DELETING SPACES AT THE BEGINNING OR END OF THE STRING
CHECK IF THE STRING IS NULL OR EMPTY
CHECK IF A STRING IS CONTAINED IN ANOTHER STRING
COMPARISON OF TWO STRINGS
DECOMPOSITION OF A STRING INTO MULTIPLE ELEMENTS OF AN ARRAY
ARRAY OF CHAR
TEXT FILES
READ A TEXT FILE
WRITING IN A TEXT FILE
CONCLUSIONS
18 – ERRARE UMANUM EST
ERROR DETECTION
SYNTAX ERRORS
DECLARATION OF UNUSED VARIABLES
VARIABLES USED BUT NOT YET DECLARED
TYPING ERRORS OF RESERVED WORDS
START OF BLOCK WITHOUT CORRESPONDING END OF BLOCK
END OF BLOCK WITHOUT CORRESPONDING START OF BLOCK
SYNTAX ERRORS PROPER
RUNTIME ERRORS
RESOURCES NOT AVAILABLE
INCORRECT DATA ENTRY
LOGICAL ERRORS
EXCEPTIONS
TRY ... CATCH
TRY ... CATCH ... FINALLY
THROW STATEMENT
DEBUGCLEAN UP YOUR CODE
METHOD OF EXECUTION
BREAKPOINT
TRACEPOINT
CONCLUSIONS
19 – WHAT OOP MEANS?
OOP, THIS UNKNOWN
CLASSES AND OBJECTS
CONSTRUCTORS
CLASSES WITH MULTIPLE CONSTRUCTORS
INSTANCE ATTRIBUTES AND STATIC ATTRIBUTES
INSTANCE ATTRIBUTES
STATIC ATTRIBUTES
SHARED METHODS
CONCLUSIONS
20 – THE THREE PILLARS OF OOP
KEY FEATURES OF OOP
ENCAPSULATION
SCOPE OF VISIBILITY
QUALIFIED NAME
INHERITANCE
HAS A RELATIONSHIP
IS A RELATIONSHIP
INTERFACES
POLYMORPHISM
POLYMORPHISM THROUGH INHERITANCE
CONCLUSIONS
APP. A – DATA TYPES
SOME TYPES INCLUDED IN THE SYSTEM.NUMERICS LIBRARY
APP. B – CORRESPONDENCES BETWEEN DATA TYPES
CATEGORY: INTEGERS
CATEGORY: FLOATING POINT NUMBERS
CATEGORY: LOGICS
CATEGORY: OBJECTS AND CLASSES
CATEGORY: OTHER TYPES
BIOGRAPHY
PROGRAMMING IN C# 10 – Basic Techniques
Author: Mario De Ghetto
1st edition: 2022 - Published by Youcanprint.it Copyright © 2022 Mario De Ghetto
ISBN: 979-12-21401-79-0
No part of this book may be reproduced, stored in a system that permits its processing, or transmitted in any form or by any means, electronic or mechanical, nor may it be photocopied, reproduced, or otherwise recorded, without the prior written consent of the Publisher, except in the case of brief quotations contained in critical articles or reviews.
This publication contains opinions of the Author and is intended to provide information as precise and accurate as possible. The elaboration of the texts, even if treated with scrupulous attention, cannot imply specific responsibility of the Author or of the Publisher for possible errors or inaccuracies.
INTRODUCTION
As a computer enthusiast and professional for almost 40 years, I have never forgotten the initial difficulties I encountered when I first started programming.
At the time when I started, the technology of personal computers was really still in its "primordial" state: programs were almost all with character interface, there was no Windows and the characters were all the same size and even the same color, usually green, there were no windows, and you could run only one program at a time.
There were no hard disks but floppy disks, there were big and heavy monitors, no local network, no wi-fi, no Bluetooth, no Internet, no USB sticks, no smartphones, no tablets, no laptops (at most "portable" but very bulky).
Moreover, there were not many "computer scientists" around like today: information was learned directly in the field or by trying to transcribe long program listings from specialized magazines. The more fortunate had had some high school training, but even they generally used "dumb" terminals connected to a single mainframe.
In a few decades things have changed completely: it is amazing to compare how people worked then with how they work today with computers.
The aspect that has not changed and that has remained virtually the same is the initial difficulty of people who begin to approach the computer to learn how to use it, although certainly smartphones, e-readers (such as Kindle) and tablets help a lot. For those who want to program, then, the learning curve is even steeper.
It's true, now the programs are much more intuitive and generally easier to use, within certain limits. But there are many more things to learn, and people expect to get much more out of computers than they did years ago.
Nowadays, everyone is faced with the problem of writing a letter, doing some math with a spreadsheet, signing up for Facebook and posting pictures of their last vacation, or opening a blog on the Internet and, why not, preparing a presentation for the office.
For programmers, the challenge is therefore very strong, because you have to know a lot of things in order to create valuable applications. For example, think about these topics: development environment (in our case Visual Studio), the framework (.NET, Java etc.), a programming language (Visual Basic, C#, F#, Java, Python etc.), algorithms, graphical interface (Windows Forms, WPF, UWA, MAUI, ASP.NET...), database (Access, SQL Server, MySQL, NoSQL…), security... the list is almost "endless".
We can realize that today's developer has more and more the need to keep updated on new development techniques to avoid being cut out of the market in a few years.
From the point of view of "budding developers", i.e., beginners, students, enthusiasts, and workers who use some development tools for only a portion of their working time or their free time to solve specific problems, it becomes difficult to navigate in the flood of products and technologies, in a spasmodic succession of novelties.
In part, these problems can be solved by searching the Internet (stackoverflow.com☺ ) and asking other experts through the many technical communities that, thanks to blogs and forums, always manage to be very close to the problems of end users.
Today there are many more opportunities to expand your knowledge than in the past. Microsoft itself has understood the important role of the Community in the promotion and diffusion of new technologies, and therefore for a long time now has been promoting collaborations with developer communities, in order to jointly organize live and online training events (the so-called webcasts or webinars). Microsoft has come to the point of awarding annually, for many years now, with the appointment of MVP (Most Valuable Professional), the experts who most distinguish themselves in supporting users and other developers in solving technical problems. I was also named Microsoft MVP from 2008 to 2019.
However, even Communities can do very little to make up for the lack of basic knowledge of users. Those who start from scratch, above all, have difficulty even explaining their needs, because they don't have a background of technical terms and concepts that are basic in programming.
Fortunately, thanks to the spread of texts like this one, even users starting from scratch have the opportunity to start from the basics of programming, learn the basic concepts and gradually build their skills with increasingly challenging goals.
This text obviously does not pretend to teach you everything, but at least to accompany you at the beginning of the long road: in fact, it was designed for those who start (almost) from scratch, although the large amount of material that can be found will satisfy even many more experienced programmers. A little review, every now and then, can only do good.
Visual Studio 2022
It is the new version of the well-known development software designed by Microsoft, intended to replace previous versions.
The range of uses for Visual Studio 2022 is extremely wide: personal use, for example, as a hobby or for study, or professional use for individual developers, as well as use within entire development teams.
The advantage of Visual Studio, for the professional developer and for development teams, is that it is a multilingual environment, as it is able to integrate multiple programming languages: Visual Basic, C#, F#, managed and unmanaged C++, web development tools and many other .NET languages.
In addition, the editor itself can effectively handle scripts and code of various kinds, such as JavaScript, CSS, HTML and XML, web extensions, such as AJAX 1.0 for ASP.NET, database connections and specific editors and viewers for schema and data management and also many other resources such as icons, images, text files and so on. All this makes Visual Studio an extraordinary product.
From this description it is possible to understand the capacity of Visual Studio to manage even complex projects, for the connection with the most varied data sources, for the management of graphics and resources, for the use in network in multi-user and on mobile devices.
Moreover, Visual Studio is now 64-bit and therefore it is able to load solutions composed of many projects and many files in a very short time.
As already specified, Microsoft releases Visual Studio also in a free version. The Community version can be downloaded for free from the Internet and can be used without any limitation of time or scope, allowing the great mass of students and hobbyists to use this extraordinary development system, without precluding its commercial use. The only small limitation: it is necessary to register (free of charge) in order to obtain the activation key and to be able to use the product freely, even for commercial purposes.
This allows the student or the hobbyist to experiment in depth the potential of Visual Studio without any expense, with the possibility then to switch, if necessary, to the Enterprise version without changing in any way the way you program.
Let's not forget, then, the possibility to download and install the evaluation versions without any limitation, except that the user license states the exclusion for commercial purposes and the use limited in time.
Also, for .NET there has been an evolution: now version 6.0 is available.
The particular aspect of Visual Studio is the fact that we can decide each time which version of
.NET we want to use.
Using the Visual Studio IDE we can write, execute, test and correct programs in a very short time compared to the time it would take to do it without the IDE. This process that allows you to quickly build an application is called RAD (Rapid Application development).
That's not all! Microsoft has also made its flagship database management product, SQL Server, available for free. These products, as well as the higher end paid versions, integrate perfectly into the development environment, allowing management even within it and facilitating integration of database objects with data access components.
All this makes life really easy for programmers, students and hobbyists, because it puts in their hands the best that could be wished for: the most powerful development system in existence, equipped with integrated tools and able to meet all needs.
Who should read this book?
It may seem trivial, but this book can be used profitably by anyone interested in programming in Visual Basic.
The style with which this text was written is as simple as possible and allows to understand even the most complex concepts. Some concepts that in the previous editions seemed not perfectly clear, have been revised, rewritten, and integrated with further explanations, to illustrate them in the best way.
The numerous code examples allow you to start from scratch and reach a good level of knowledge of the language.
This ensures that the text can be read by students, aspiring programmers, hobbyists, teachers and, of course, experienced developers.
For a profitable reading, what I ask you is only to make a concrete commitment to understanding the fundamental concepts that are the basis of programming in C#. In particular, it would be advisable to read the book, if possible, in front of the computer with the development environment open. When I explain programming techniques and the use of specific features, you can try them directly on the computer: in this way you will be able to assimilate the concepts and skills in the shortest possible time and with the best result.
Everywhere you'll find a lot of code: test small programs to explain a technique in a simple way and some complete and working programs.
The vastness of the topics that can be treated, related to the development of applications with C#, would probably allow to write a book of several hundreds or maybe some thousands of pages. Considering that such a large book would not be practical, nor possible to bind, only information about the basic techniques of the language has been included in this volume. Moreover, all the examples are based on the use of the Console (similar to the "prompt for DOS"), to avoid introducing all the complexity of visual applications (windows, visual and non-visual controls etc.). Also, among the topics you won't find anything about database management, nor advanced programming techniques.
All this could make the idea of a limited book and poor in content, but in reality, the choice was made to divide the topics into several books, so as to make manageable the use of volumes (have you ever tried to keep open a book of 1,400 pages near the keyboard?) and be an effective tool for work and study, as well as a reference manual for various programming techniques.
For now, I wrote this book with basic techniques for programming in C#: the intention is to write also a book on visual programming (Windows Forms, WPF, UWA, MAUI etc.), one on database programming, one on advanced programming techniques and maybe one on algorithms (sorting, matrices, graphs and so on).
Warnings, feedback and sample code
Windows 10/11 and Visual Studio 2022 are highly customizable and can also be modified by periodic updates, libraries and extensions installed on your computer. Your system, therefore, may look very different from the images shown in this text. It is not possible to guarantee the absolute fidelity of the images with the system configuration and the possible customizations of the user. The greatest possible care has been taken in writing the text and preparing the examples, but despite the effort, there may still be some errors. You are invited to report errors, but also suggestions and advice, to the e-mail address [email protected]. For any errors that may be found after publication I will insert an "errata corrige" text in the compressed file that contains all the examples of this book (see next paragraph "Useful Resources").
In any case the material is provided as is and the author cannot be held responsible for any damage that the user may commit, even on the basis of what is contained in this book.
Useful resources
[1] Examples and possible "errata": http://www.bell1.net/books/main/download/17_LibroCs10/17_Cs10vol1_examples.zip;
[2] Author's blog (https://deghettoen.wordpress.com);
[3] MSDN (http://msdn2.microsoft.com/it-it/library/default.aspx);
[4] Author's software: http://deghetto.bell1.net/deghetto/indice_sw;
[5] Other books and articles by the author: https://app.gumroad.com/mdeghettoeng;
Acknowledgements
I owe a special thanks to my family. My wife Ornella and my son Andrea are very understanding towards a husband and a dad who write texts in the middle of the night, although sometimes they are a bit jealous of this machine that has all my attention for many hours of the day (and night). So, I want to tell you that in my heart there is only you.
Thanks also to all the readers of my texts. Many of you write to me and ask me to solve some technical problems. I always try to answer to all the mails I receive, but it is not always possible for me to provide solutions, due to work and family commitments. I invite you, therefore, to send your technical requests in the technical forums, where you will find many good professionals.
This does not mean that I do not welcome your feedback and your suggestions to improve my texts and to make them more and more a useful support to your work and your passion for programming. Do not hesitate, therefore, to write to me ([email protected]) to report errors and/or omissions and to suggest new topics that interest you: I assure you that all mails will be taken into serious consideration.
Thank you!☺
In the same series
If you are a student or need to participate in a selection or if you simply want to learn how to use a word processing program to expand your knowledge, this is the book for you. An introductory book to learn how to use Microsoft WORD, included in OFFICE 365 or as a separate product, and discover many interesting things about how to insert an image, draw a table, create a title with artistic fonts for flyers and much more.
Title > OFFICE 365 – HOW TO USE WORD
Author > Mario De Ghetto
Year of publication > 2022
Editor > Youcanprint Pages > 148
ISBN > 979-12-20399-54-8
Link > https://www.youcanprint.it/office-365-how-to-use-word/b/366e4437-3e31-5077-b871-3da56447248d
1
1 – First contact
Before we can face the study of the C# language, we have to get familiar with Visual Studio 2022: let's see what it is about and how it can be useful to us. It will also be an opportunity to see a first program in C# and understand what OOP is.
What is Visual Studio 2022 for?
Integrated Development Environments (IDE) are a very particular category of application programs: they are programs that serve to build other programs. Among the many existing development environments, one has perhaps had the most success of all: Visual Studio, produced by Microsoft, now in version 2022. Internally it is classified as version "17".
NOTE – IDE stands for Integrated Development Environment. For convenience, in this book we will use the acronym IDE instead of Integrated Development Environment. The acronym VS is also commonly used for Visual Studio, while C# can also be found in the form Cs or Csharp.
Visual Studio is a software that allows you to use various programming languages, but also many useful tools for the management of the entire life cycle of any type of application:
• design and creation of prototypes;
• user interface creation, including designers of graphical user interfaces and emulators of mobile devices;
• code writing with the code editor;
• management and interaction with data sources: design, modeling, viewing/editing;
• documentation management;
• tests (by means of unit tests);
• debug, with many tools for analyzing the code and the running program;
• creation of the installation package;
• release and distribution of the application.
The main supported languages are the "historical" ones produced by Microsoft: C#, Visual Basic, F#, and C++, but a complete support is also provided for other languages such as Python, JavaScript, and TypeScript.
NOTE – In this book we will deal exclusively with C#, but there may also be references to general concepts and techniques applicable to any language that can be used with Visual Studio.
PROTOTYPE: a test application, often largely (intentionally) non-functional, created to verify adherence to functional requirements or to test a new user interface. This is almost always a "disposable" application, needed only at certain times during the development phase.
DESIGNER: is a tool that literally allows you to design the user interface, "drawing" the controls visually and therefore very quickly.
CODE: is the generic term that indicates the set of instructions expressed in a programming language.
EMULATOR: is a software component that simulates the graphics and functionality of a physical device and therefore allows you to test an application without having physically available the device itself. For example, there are emulators for iPhone and Android smartphones.
Visual Studio, as we have known it for about twenty years now, allows you to create applications more quickly and productively through the use of .NET Framework, a set of many libraries defined in many namespaces (= namespaces) and containing tens of thousands of classes.
.NET Framework can be extended with additional libraries released by Microsoft itself or by other software houses. Alternatively, we too can create our own libraries, using the .NET Framework classes we need or writing our own classes.
NOTE – .NET CORE is basically the evolution of .NET Framework redesigned by Microsoft to provide cross-platform support (Windows, Linux, macOS and mobile devices through Xamarin or integration with other frameworks), different programming paradigms and better workflow on the cloud. (Windows, Linux, macOS and mobile devices through Xamarin or integration with other frameworks), different programming paradigms and better workflow on the cloud. In chapter two, we'll take a closer look at what this is all about.
There are three main editions for developing applications with Visual Studio, each of them dedicated to a particular type of developer and with different licenses for use:
• Visual Studio Community is the free version for students, individual developers, or even small groups of developers (maximum of five and not included in organizations that charge more than one million dollars or have more than 250 PCs or users). The license does not exclude commercial use, but we recommend that you carefully check the license details of the Community edition to avoid unauthorized use;
• Visual Studio Enterprise is the edition that is complete with everything and obviously the most expensive. Until some previous versions of Visual Studio had the name of Ultimate. Ideal for very large development teams;
• Visual Studio Professional is an edition that only lacks the management features of the development team and is suitable for an individual developer, obviously with a lower cost than the Enterprise version.
Visual Studio 2022 moves from 32-bit to 64-bit
Until version 2019, Visual Studio was running on 32-bit but finally, since version 2022, Visual Studio is 64-bit. This implies that the main process of devenv.exe is no longer limited to 4 Gigabytes of memory: if you have more than 4 Gigabytes of RAM, therefore, you can load solutions full of projects, which are in turn full of files, and all this at an enormously higher speed than in previous versions.
If you want to see an example of the loading speed of 1,601 projects, containing nearly 300,000 files, take a look at the GIF https://bit.ly/GIFVS2022, posted on the Visual Studio development team blog.
Supported languages
As we have already stated, the languages provided in Visual Studio, either directly developed by Microsoft or only supported, are many: in addition to the traditional C#, Visual Basic, F# and C++, in fact, there are TypeScript, JavaScript, Python and others. The discussion about which language is the best is traditionally still alive among C# and Visual Basic developers. Until the 2010 version, the choice between the VB and C# languages was dictated almost solely by personal preference and the breadth of knowledge of the developer: in fact, the two languages had the same potential, because both are based on object-oriented programming (OOP) and on the libraries of .NET Framework, while obviously they differed in the syntax, that is the "grammar" and the spelling with which the instructions are written. In more recent versions the parity of the functionalities of the two languages has been lost, because C# has continued to grow, with the introduction of new functionalities, very often "imported" from the functional paradigm, of which the F# language is the most complete expression. Visual Basic, on the other hand, lagged behind, except for a few adjustments that served to correct some errors. The Microsoft development team has motivated the block of Visual Basic development with the need to give stability to the language.
NOTE – Our opinion is that to bring forward the Visual Basic language is now economically unsustainable for Microsoft, since commercially it is a "duplicate" of C#: C# does the same things as VB and, indeed, does more. This doesn't mean that Visual Basic will remain in the real world for decades as it happened with VB 6.0, since there are now tens or hundreds of thousands of applications written in VB.NET. The conversion to C# will happen sooner or later, but very gradually and only when it will be necessary to extend the field of applications to other platforms or to new features that are not available in Visual Basic.
The C# language has had several extensions that allow it to be used in cross-platform applications: Windows, iOS and Android for mobile devices and Windows and Linux for the desktop environment. This language, therefore, is the ideal candidate to take full advantage of the new .NET Core (or .NET) framework.
The target of C++ language, however, is very different from the two languages mentioned above. In fact, C++ is more oriented to the design of lower-level programs (closer to the machine): operating systems, compilers, drivers, but also utilities in native code, that is executable directly from the processor, without the support of .NET Framework (C++ unmanaged). To be precise, however, even C++ is a language that allows object-oriented programming.
Support for the C++ language is necessary for Visual Studio to be able to write and compile programs to be loaded as "firmware" to microcontrollers such as Arduino.
MANAGED/UNMANAGED: The terms "managed" and "unmanaged refer to "managed code" and "unmanaged code" within the .NET Framework or .NET Core, respectively. C# and C++ can compile both managed and unmanaged code.
F#, instead, is a language that allows to program with the functional paradigm of mathematical and scientific derivation, but that can be used with profit also in our applications. It is an interesting language because it is very concise, almost mathematical, and can be used effectively within function libraries that can then be called by C# applications.
Programming paradigms
Programming paradigms are the fundamental styles of programming, understood as a set of conceptual tools available to the programmer in a given programming language. A programmer can write a program using program elements (e.g., variables, objects, functions) and specific procedures to perform processing on the data (loops, assignments, calculations, etc.). There are many programming paradigms, because many best practices stimulate the creation of new languages and new paradigms that, from time to time, offer new potentials and often an increase in productivity of the developers. The programming paradigms adopted to date, some better known, others less so, are as follows:
• imperative programming;
• declarative programming;
• modular programming;
• aspect-oriented programming;
• user-oriented programming;
• object-oriented programming (OOP);
• structured programming according to patterns;
• programming by pattern matching;
• procedural programming;
• structured programming;
• programming for abstract data types;
• concurrent programming;
• logic programming;
• functional programming;
• event-oriented programming;
• constraint programming.
Some languages, such as C#, adhere to more than one programming paradigm. If we take any C# program, we will find that it adheres to the very important paradigm of object-oriented programming, because in C# "everything" is an object, even the user. In C# we also find the event- oriented programming paradigm, in particular for the definition of the behaviors of graphical interfaces, and we can also use the techniques of structured programming. Of course we can also easily identify the paradigms of imperative programming (instructions are "commands"), declarative programming (for example in the context of graphical interfaces defined in WPF applications, with XAML code) and functional programming (LINQ library instructions and other functional techniques often derived from F#).
You must have realized by now that the world is not just black and white, as you can find a thousand colors and shades in it. Similarly, in C# you can program with various programming paradigms, although the fundamental paradigm used everywhere is that of object-oriented programming.
Before we continue, let's look at some of the most important programming paradigms used in a Visual Studio application using the C# language.
Imperative and declarative programming
Almost all programming languages adhere to the imperative programming paradigm.
The term "imperative" already partly clarifies the fact that every instruction given to the computer, through a program, is essentially an "order" to the computer.
Imperative programmingis opposed to declarative programming where orders are not given but "statements" are made that the machine is implicitly required to consider or make true.
Examples of declarative programming are all descriptive languages, called markup languages. For example, HTML and XAML do not order anything from the computer, but rather describe, respectively, how the web page or the graphical user interface of the application should look.
XAML is the language chosen to describe the graphical interfaces of WPF (Windows Presentation Foundation). XAML has been adopted also by UWP and Xamarin applications.
Event-oriented programming
Event-oriented programming is a particular type of programming in which the flow of the program does not follow a sequential path predetermined by the programmer, except at points where branching of the path takes place, following a choice. The logical flow of event-driven programming is determined, in large part, by the occurrence of particular events that affect program execution. What are these events? We could first classify events into two main categories: system events and user events:
• system events are all events generated by the operating system or hardware and detected by the operating system: one of the most obvious examples is the timer, since the timer pulses are triggered at regular intervals, independently of the user. Another example is an error for an attempt to print to a powered-off device;
• User events consist of all those events generated by a user action: a mouse move, a button click, a keyboard key press and much more.
The management of an event is realized through, exactly, an event handler. Each event handler is associated with the corresponding event and, upon the occurrence of the latter, triggers the execution of a series of instructions. In addition, an event can trigger a series of other cascading events, each of which is processed by the corresponding event handler, and so on, until the entire event queue is exhausted.
Event-driven programming is generally used in the context of graphical interfaces, so it is not a coincidence that it saw the light with visual languages, such as Visual Basic and C#.
Functional Programming
Functional programming is a paradigm that involves a programming flow consisting entirely of a series of mathematical functions to be evaluated or functions to manipulate sets of elements (set theory, as is well known, falls under the umbrella of mathematics).
The main advantages of this type of programming are the absence of side effects and therefore easier program maintenance, absence of errors and greater optimization.
We find it mainly in academia and industry, although in recent times it is increasingly appearing in more commercial application areas: for example, in banking, insurance and statistical applications in general.
As we have already mentioned, one .NET language that adheres to the functional programming paradigm is F#. Other well-known languages that adhere to functional programming are LISP and LOGO, but Ruby, Python, and Perl can also use a functional style.
In C# we can find some elements of functional programming: for example, when we use LINQ
statements instructions or other constructs that were introduced in the wake of F#.
LINQ: is a library introduced with Visual Studio 2005 and .NET Framework 3.5, to manipulate and query sets of objects or elements of various kinds, using a syntax similar to SQL.
Object-Oriented Programming (OOP)
Here we finally come to the paradigm of object-oriented programming. We have already mentioned that for the languages managed by the .NET Framework everything is an object: the computer, the data, the database, the user, the files, the flows in reading or writing a file or a video.
In this book we will explain what objects are, how they are created, how they are managed, how they are used, how they are destroyed and many other things.
The paradigm of object-oriented programming starts from a very precise assumption: the application will be nothing but a representation of a part of the reality that surrounds us and, in particular, of that part that we are interested in managing in the application itself. This reality of interest will contain some objects, with their characteristics and behavior:
• by characteristics we mean the properties (also called attributes) of a certain object. For example, for a car, the properties are the color of the body, the number of people that can be transported, the engine displacement, the type of power supply (hybrid, electric only, gas, green gasoline, diesel ...), the brand, the model, the chassis number, the current position of the clutch (pressed or not), the current state of the engine (on, off), the status of the direction arrows (off, on the right, on the left, all lit) etc. ;
• by behavior we mean the actions that an object can perform. For example, the same car will be able to perform various actions: start the engine, turn off the engine, engage the gear, brake, turn on the lights, turn the steering wheel to the right and so on. The actions are expressed through methods, that is, routines containing various instructions.
Summarizing, an object has its own state (the data) and its own behavior (the methods). Moreover, the state of an object can change in time: the engine may have been turned off and shortly thereafter turned on because the action of turning on the engine was performed. Actions, then, can change the state of an object.
The state of the object can determine not only the current representation of the object but can also affect whether or not certain actions are performed. For example, you cannot turn on an engine that is already running and you cannot turn off an engine that is turned off. The state, therefore, is the instantaneous situation of the object that can change in time.
Another important aspect of object-oriented programming is the fact that multiple objects can have the same type of attributes and behaviors. That is, such objects belong to the same class of objects.
Classifying various objects is an exercise we have done before in school. For example, try classifying the following "objects" into the "living" and "non-living" classes: cow, cat, iron, sunflower, salad, water, salt. It's not difficult, is it? In fact, we have been accustomed since childhood to classify objects and to recognize to which class any object belongs. It has become like a natural, almost instinctive skill.
Let's take it a step further: talking about class or type is the same thing. Even in common language we can say that the cat is part of the class of animals (or more properly of the class of felines), or we can say that the cat is a type of animal (or a type of feline) or, again, that that animal is a type of cat. In object-oriented programming, you can talk about class or type in the same way, depending on the context.
The fundamental concepts of object-oriented programming
Object-oriented programming, often identified with the acronym OOP, is so important in C# and in the other .NET languages that we must immediately start to know the three fundamental concepts that constitute the pillars on which this paradigm is based: inheritance, encapsulation and polymorphism.
It is true object-oriented programming if all three of these concepts apply, otherwise it is at best object-based programming.
Since this is a very important subject, we will briefly analyze them one by one. In the course of the book, we will have the opportunity to treat them again, but in much greater depth.
Inheritance
To understand the concept of inheritance, let's imagine that we have a generic class that represents, for example, the classification of the animal kingdom.
AnimalKingdom
Poriferous
Sponges
Rings
SegmentedWorm
Earthworm
Leech
Platyhelminthes
Dishworms
Tapeworm (roundworm)
Arthropods
Coelenterates
Nematodes
Echinoderms
Mollusks
Chordates
Fish
Amphibians
Reptiles
Mammals
Felines
Cat
Tiger
Lion
Cheetah
Canids
Man
Birds
NOTE – We have represented only part of the classification for space reasons, but it is enough for our purposes. We will not follow the taxonomic subdivision currently used in the natural sciences (life, domain, kingdom, phylum, class, order, genus and species), but we will use at each level the only term that interests us in the context of object-oriented programming: class.
In OOP, a class can be derived from another class and thus inherit all the basic features, possibly adding some more specialized features.
In our example, the Animal Kingdom is divided into various branches, including the Chordates (animals with backbones) which in turn are divided into other classes including Mammals, in turn divided into other classes including Man.
From this organization in classes, we can guess that the class Cat derives from the class Felines which, in turn, derives from Mammals. Going up one more level, the classes mentioned above derive from the generic class Chordates.
A dot (.) notation can be used to name derived classes, specifying their entire "path", as in the following example:
AnimalKingdom.Chordates.Mammals.Felines.Cat
This is the full name of the Cat class and should be used, in whole or in part, when somewhere else another Cat class exists, even if it has a different meaning. As we'll see, you can also use just part of the full class name by abbreviating it. This makes the code more concise and readable.
NOTE – We have introduced the dot notation (.). The dot between two elements (two classes or a class and its method or attribute) simply means that the element to the right of the dot "belongs" to the element to the left.
The same thing can be done when you need to refer to a method or to a property of a class. For example, to indicate the color of a cat we can refer to the corresponding property:
If we wanted to change the color of a cat, we could use the specific method:
Cat.ChangeColor("White");
METHOD: unit of code expressed in the form of a subroutine or of function). This unit of code defines the actions (behavior) of objects of the same class.
PROPERTY: an elementary piece of information that characterizes the state of an individual belonging to the class that defines it.
NOTE – Do you see that the instructions above have a semicolon (;) at the end? In C# you must always put a semicolon at the end of an instruction, otherwise an error will be reported by the compiler and also by IntelliSense (we will tell you later what it is about...)
We can also explain the concept of derived class in another way: the classes that are in a higher level of the hierarchy are more generic classes, while as we go down the hierarchy we find classes at lower levels that are increasingly specialized classes, since they add more specifications. These specifications consist of several attributes and/or a number of methods.
Encapsulation
Another important principle of object-oriented programming is encapsulation. The term already helps in part to understand the concept it refers to: not all attributes are exposed to the outside world to be visible to other classes. On the contrary, most of the attributes remain (and must remain) hidden inside the class and whoever observes it from the outside does not even know that these attributes exist.
A popular view, so much so that it is considered one of the best practices of object-oriented programming, is that no attribute is directly visible from the outside. In this way, we will not be able to access those attributes directly, but we will only be able to read or manipulate attributes for which appropriate read and/or write methods have been defined.
Encapsulation makes a class very similar to a "black box": interaction with the black box (class) is limited to methods that can be called. It is not possible in any way to change the internal state of the black box except in a strongly controlled way through methods. In this scenario there is a collateral advantage: if from the outside it is not possible to see any modification of the "access points" (methods) to the black box, we can modify even heavily the code inside the class without having to change even one line of code in the rest of the application. Technically, in this case we speak of a high degree of isolation between the inside and the outside of the class.
Polymorphism
Polymorphism refers to the ability to interact with two or more classes, which have a set of common methods and properties, without having to identify exactly what type of object you are working with.
For example, we could make a collection of objects of type Animals that can accommodate one or more references to objects of type Dog, Cat, and Canary. Each of the specialized classes Dog, Cat, and Canary will also have specialized methods and attributes that characterize the particular class. For example, the Cat meows, but the Dog barks. Other methods and attributes, however, will be common: all animals eat, move, sleep, and so on.
These common elements allow us to classify them as animals and then place them in homogeneous sets, such as the aforementioned class Animals.
First easy examples in C#
It is now an established tradition that every programming book begins with a short program of greeting to the world ("Hello world!") and therefore, also in this book we will not escape the tradition. This example was created with the template Windows Forms App (.NET Framework):
NOTE – Namespaces cannot start with a numeric digit, so the name "0 _0 _CS" is invalid. If we enter a name that has a numeric digit as the first character, Visual Studio will automatically add an underscore ( _ ) character before the numeric digit. For example, the name "0 _0 _CS" will become "_0 _0 _CS". Because it seems ugly and impractical to us, in this book we started the names of the examples with the acronym CS (CSharp).
Let's now examine how this program is structured.
First of all we have two using instructions statements that are used to import the System and
System.Windows.Forms libraries that are included in the .NET Framework:
using System;
using System.Windows.Forms;
Technically, System and System.Windows.Forms are two namespaces that contain various classes, interfaces, properties, and many other things.
When we create a new project, it too will have its own namespace, and in the case of the example we just saw, this namespace is called CS_01_01:
namespace CS_01_01
Immediately after we have the opening of a curly bracket that is associated with the closed curly bracket that we find at the bottom of the code block. If we didn't have the definitions inside the namespace and also removed the using statements, the whole thing could be condensed into these lines of code:
namespace CS_01_01
{
}
or:
namespace CS_01_01
{ }
or:
namespace CS_01_01 { }
You can condense the code as you like, depending also on what you put between the curly brackets. Between the two curly brackets, in our example, is the definition of a class:
public partial class Form1 : Form
{
...
}
Even the definition of a class has its own pair of curly braces to define its contents.
The name of the class is Form1 and is derived from the more general Form class, the definition of which is in .NET Framework. In general, the notation Form1 : Form indicates extremely concisely that Form1 is an instance of Form and inherits all of its characteristics. An instance is, simply put, the actual object named Form1 that has been created from the Form class. In other words, Form contains the instructions for creating one or more objects (or instances) of type Form, while Form1 is the actual object or instance created from Form.
For the moment we'll gloss over the public and partial specifications, because we'll see them in more detail in other chapters of this book
Inside the class definition, we find two methods. The first one is the so-called constructor that serves to "build the object": it contains, that is, all the instructions that serve to define the state and the behavior of the object we are creating. This is the code of the constructor that has the same name as the class:
public Form1()
{
InitializeComponent();
}
The InitializeComponent() instruction invokes a method of the Form class, inherited from the Form1 instance, which is used to initialize the form as a container for visual controls. This instruction must be there all the time, otherwise the instance cannot be created, and an error will be generated. The other method in the class is as follows:
private void button1_Click(object sender, EventArgs e)
{
MessageBox.Show("Hello World!");
}
Even here we don't go into the private and void keywords that we will see later. Let's not even go into the parameters that are passed to the method (object sender and EventArgs e) because they are usually used for error handling (which in this area are called exceptions).
We then find button1_Click which gives us two pieces of information: first of all we have inserted a button (a control of Button type, i.e. of Button class) named button1; also we see that this is the method that handles the Click event. In essence:
• the user clicks on the left mouse button when the pointer is right on Button1;
• such action triggers the event Click of button1 that activates the method that manages the event button1_Click, executing the instructions that are contained to its inside.
Inside the Click event handler of button1 we have the instruction that finally shows us the traditional greeting to start the first program created with our new programming language:
MessageBox.Show("Hello World!");
Here we see that we are using a MessageBox class that defines a message box for the user. Of this class we invoke the Show method that requires a string parameter and that we pass between two round brackets. The string (intended as a concatenation of characters) must be enclosed by a pair of quotes. As every C# instruction, at the end of the line must be put the character ";" (semicolon).
NOTE – Many developers don't like having to put a semicolon at the end of instructions. However, it is the notation of other languages such as C, C++ and Java as well. After all, C# is said to be derived from the C++ language and thus inherited this nice (!) feature.
Starting the simple example (by clicking on the "Start" button, having a green triangle pointing to the right), you will see that a window containing a single button (named button1) will be displayed with the words "Press here! ". After clicking on the button, you will see a small window appear with the message "Hello World! ", and with a confirmation button ("OK"). Clicking on the latter will close the message window. In Figure 1.1 you can see the result of running the program.
Figure 1.1 – The first example of a Windows Form App.
The only instruction we had to insert is the following instruction:
MessageBox.Show("Hello World!");
All the rest of the code has been prepared automatically by Visual Studio. The code that has been inserted by Visual Studio must not be modified, otherwise it might break something and not work anymore.
WARNING – Modifying the default code is strongly discouraged, but if you have special needs and a lot of experience with .NET projects you can try to tackle this challenge. Before modifying the default code, we recommend that you always make a backup copy of the entire Solution.
Since we'll be focusing on code in much of this book, on topics more complex than what we've seen, we think it's didactically much more productive to eliminate anything superfluous to simplify your understanding. Therefore, in most of the book we will not use visual programming: instead, we will use the Console Application template that makes us interact with the console window (basically the same as the "Command Prompt" or MS-DOS window). Picking up on the CS_01_01 example, here's the form it will take in the example suitable for the Console:
As you can see, the import of the System.Windows.Forms library is missing here, and there is no Click method of the button1 button, because we no longer have either form or button. Moreover, we have a Main method that is the access point to the program: inside it there is an instruction equivalent to the one we saw earlier, only that we use the Console class, while the invoked method is WriteLine.
The beauty of the new version of C# (version 10 distributed with Visual Studio 2022) is that we don't even need all this structure to execute the simple command contained in the program. In fact, we could reduce it to these simple instructions:
Example: CS_01_03
using System; Console.
WriteLine("Hello World!");
In other situations, we will need the structure of example CS_01_02 to create namespaces, classes, and their methods, but for simple tasks this reduced form is ideal.
C# Interactive window
Do you want to do something even faster, i.e., try one or more instructions "on the fly", without creating a program on purpose? Then you must try the "C# Interactive" window: click on the menu View > Other Windows > C# Interactive.
A window like the one you can see in Figure 1.2 will open:
Figure 1.2 – The C# Interactive window.
In the window you can see a header, the advice to type #help to get more information (including the possibility of loading a .dll library or a script containing a series of instructions to be executed), the instruction to display "Hello World!" and the result of executing the same instruction.
The symbol ">" at the beginning of the line is the "prompt", i.e., the indicator of the position where we can insert our instructions: once each instruction is written, just press the enter button to execute it immediately.
NOTE – Don't worry if you don't fully understand this first chapter: it's just a taste of object- oriented programming, the .NET Framework, and programming in C#. There are still many aspects to be examined so keep reading... you won't regret it!
Conclusions
This is just a small part of everything you can do with Visual Studio, but in this book, you'll discover many other interesting things.
In this chapter we met several interesting "characters": Visual Studio, .NET Framework and C#.
In addition, we saw the first simple application written in the C# language: the classic program "Hello World!" to display a greeting that also in this book could certainly not miss.
Experienced readers will have noticed that we have simplified many concepts, sometimes risking to make them even banal. Our goal was to eliminate as much as possible the details that could confuse, leaving only the most important aspects to be understood.
In the rest of the book, we'll do all the necessary in-depth analysis to bring out the full potential of the C# language and .NET Framework.
2
2 – From .NET Framework to .NET 6
All .NET languages are based on the .NET Framework, so it's very important to know its features to make the best use of it, but what are .NET Core, .NET Standard, .NET 5, and .NET 6? We reveal it in this chapter.