C# for Beginners: Learn in 24 Hours
By Alex Nordeen
()
About this ebook
This book is all about getting you started fast without the need to spend days or even weeks on trying to understand Csharp. This e-book eliminates the common fear of long and complex code that beginners usually face. It has picked some best illustration that is difficult to find anywhere at this price. After reading this book, you will find yourself playing with code on very same day.
Exploring yourself to .NET technology is an additional benefit of this book. Readers would prefer using this small e-book as a reference guide to all basic fundamentals of C#; they are all nicely explained. Your prejudice towards coding will no longer be same after going through this e-book.
C# is an object-oriented programming language based on C++. It is considered similar to Java, but some of its features are novel and not even found in Java. These includes nullable value types, enumerations, delegates, lambda expression, etc. These powerful features are very useful in building robust applications. If you are not in a position to attend a full-time course to learn these features. This e-book is a complete guide that covered key learning of Csharp
Table Of Content
Chapter 1: What is .NET Framework?
What is Microsoft .Net Framework?
.Net Framework Architecture.NET Components
.Net Framework Design Principle
Chapter 2: C# and .Net Version History
.Net Framework Version History
C# Version History
Chapter 3: Download and Install Visual Studio
How to Download and Install Visual Studio
Visual Studio Key Features
Chapter 4: C# Hello world
Chapter 5: C# Data Types
Chapter 6: C# Enum
Chapter 7: C# Variables operator
C# Variables
C# Operators
Chapter 8: C# Conditional Statements
Flow Control and conditional statements
1) If statement
2) Switch statement
3) While loop
4) For loop
Chapter 9: C# Arrays
Chapter 10: C# Class and Object
What is Class and Object?
How to Create a Class and Object
Fields and methods
Chapter 11: C# Access Modifiers and Constructor
Access Modifiers
C# Constructor
Chapter 12: C# Inheritance and Polymorphism
What is Inheritance in C#?
What is Polymorphismin C#?
Chapter 13: C# Abstract classes
Chapter 14: C# Interface
Chapter 15: C# Collections
Chapter 16: C# ArrayList
Chapter 17: C# Stack
Chapter 18: C# Queue
Chapter 19: C# Hashtable
Chapter 20: C# Windows Forms Application
Windows Forms Basics
C# Hello World
Adding Controls to a form
C# Event Handling for Controls
Tree and PictureBox Control
Chapter 21: C# Database Connection Tutorial
Fundamentals of Database connectivity
How to connect C# to Database
Access data with the SqlDataReader
C# Insert Into Database
C# Update Database
Deleting Records
Connecting Controls to Data
C# DataGridView
Chapter 22: C# File Operations
Basics I/O Commands
File.Exists
File.ReadAlllines
File.ReadAllText
Read more from Alex Nordeen
Linux: Learn in 24 Hours Rating: 5 out of 5 stars5/5Learn SAP MM in 24 Hours Rating: 0 out of 5 stars0 ratingsLearn SQL in 24 Hours Rating: 5 out of 5 stars5/5Python: Learn Python in 24 Hours Rating: 4 out of 5 stars4/5Learn SAP Basis in 24 Hours Rating: 5 out of 5 stars5/5Learn PMP in 24 Hours Rating: 0 out of 5 stars0 ratingsLearn HANA in 24 Hours Rating: 5 out of 5 stars5/5Learn JavaScript in 24 Hours Rating: 3 out of 5 stars3/5Learn SAP SD in 24 Hours Rating: 0 out of 5 stars0 ratingsLearn PHP in 24 Hours Rating: 0 out of 5 stars0 ratingsLearn Software Testing in 24 Hours Rating: 0 out of 5 stars0 ratingsLearn Data Warehousing in 24 Hours Rating: 0 out of 5 stars0 ratingsBusiness Analysis : Learn in 24 Hours Rating: 0 out of 5 stars0 ratingsLearn SAP HR in 24 Hours Rating: 5 out of 5 stars5/5Learn MongoDB in 24 Hours Rating: 5 out of 5 stars5/5C++ Learn in 24 Hours Rating: 0 out of 5 stars0 ratingsHacking : Guide to Computer Hacking and Penetration Testing Rating: 5 out of 5 stars5/5Learn Operating System in 24 Hours Rating: 0 out of 5 stars0 ratingsLearn Selenium in 24 Hours Rating: 0 out of 5 stars0 ratingsLearn Excel in 24 Hours Rating: 4 out of 5 stars4/5Learn R Programming in 24 Hours Rating: 0 out of 5 stars0 ratingsLearn AngularJS in 24 Hours Rating: 0 out of 5 stars0 ratingsLearn C Programming in 24 Hours Rating: 0 out of 5 stars0 ratingsLearn SAP BI in 24 Hours Rating: 3 out of 5 stars3/5Learn Hadoop in 24 Hours Rating: 0 out of 5 stars0 ratingsLearn SQLite in 24 Hours Rating: 0 out of 5 stars0 ratingsLearn Design and Analysis of Algorithms in 24 Hours Rating: 0 out of 5 stars0 ratingsLearn Cassandra in 24 Hours Rating: 0 out of 5 stars0 ratingsLearn JSP in 24 Hours Rating: 0 out of 5 stars0 ratings
Related to C# for Beginners
Related ebooks
C# Programming Illustrated Guide For Beginners & Intermediates: The Future Is Here! Learning By Doing Approach Rating: 0 out of 5 stars0 ratingsC# Programming Fundamentals Rating: 0 out of 5 stars0 ratingsMastering C# and .NET Framework Rating: 5 out of 5 stars5/5C# For Beginners: An Introduction to C# Programming with Tutorials and Hands-On Examples Rating: 0 out of 5 stars0 ratingsASP.NET For Beginners: The Simple Guide to Learning ASP.NET Web Programming Fast! Rating: 0 out of 5 stars0 ratingsVisual Studio Code: End-to-End Editing and Debugging Tools for Web Developers Rating: 0 out of 5 stars0 ratingsLearning ASP.NET Core MVC Programming Rating: 5 out of 5 stars5/5C Programming Language Rating: 4 out of 5 stars4/5Learn Multithreading with Modern C++ Rating: 0 out of 5 stars0 ratingsC Programming For Beginners: The Simple Guide to Learning C Programming Language Fast! Rating: 5 out of 5 stars5/5Objective-C Programming For Dummies Rating: 4 out of 5 stars4/5Learn Professional Programming in .Net Using C#, Visual Basic, and Asp.Net Rating: 0 out of 5 stars0 ratingsLearn C Programming in 24 Hours Rating: 0 out of 5 stars0 ratingsC Programming Language, A Step By Step Beginner's Guide To Learn C Programming In 7 Days. Rating: 4 out of 5 stars4/5Learn Java Programming in 24 Hours Rating: 0 out of 5 stars0 ratingsC# Programming from Zero to Proficiency (Beginner): C# from Zero to Proficiency, #2 Rating: 0 out of 5 stars0 ratingsPROGRAMMING IN C# 10 - Basic Techniques Rating: 2 out of 5 stars2/5C# Programming from Zero to Proficiency (Introduction): C# from Zero to Proficiency, #0 Rating: 0 out of 5 stars0 ratingsC# Functions and Tutorial - 50 Examples Rating: 0 out of 5 stars0 ratingsC# Programming & Software Development: 6 In 1 Coding Syntax, Expressions, Interfaces, Generics And App Debugging Rating: 0 out of 5 stars0 ratingsLearn Programming Using C# Rating: 0 out of 5 stars0 ratingsThinking In C# Programming. Rating: 0 out of 5 stars0 ratingsVisual Studio 2022 In-Depth: Explore the Fantastic Features of Visual Studio 2022 - 2nd Edition Rating: 0 out of 5 stars0 ratingsMastering C# 8.0: Master C# Skills with Hands-on Code Examples (English Edition) Rating: 0 out of 5 stars0 ratingsHands-On Network Programming with C# and .NET Core: Build robust network applications with C# and .NET Core Rating: 0 out of 5 stars0 ratingsC# Interview Questions, Answers, and Explanations: C Sharp Certification Review Rating: 5 out of 5 stars5/5.NET Design Patterns Rating: 3 out of 5 stars3/5
Programming For You
HTML & CSS: Learn the Fundaments in 7 Days Rating: 4 out of 5 stars4/5Python Programming : How to Code Python Fast In Just 24 Hours With 7 Simple Steps Rating: 4 out of 5 stars4/5SQL QuickStart Guide: The Simplified Beginner's Guide to Managing, Analyzing, and Manipulating Data With SQL Rating: 4 out of 5 stars4/5Learn PowerShell in a Month of Lunches, Fourth Edition: Covers Windows, Linux, and macOS Rating: 0 out of 5 stars0 ratingsLearn to Code. Get a Job. The Ultimate Guide to Learning and Getting Hired as a Developer. Rating: 5 out of 5 stars5/5The Unofficial Guide to Open Broadcaster Software: OBS: The World's Most Popular Free Live-Streaming Application Rating: 0 out of 5 stars0 ratingsCoding All-in-One For Dummies Rating: 4 out of 5 stars4/5Java for Beginners: A Crash Course to Learn Java Programming in 1 Week Rating: 5 out of 5 stars5/5Hacking: Ultimate Beginner's Guide for Computer Hacking in 2018 and Beyond: Hacking in 2018, #1 Rating: 4 out of 5 stars4/5Grokking Algorithms: An illustrated guide for programmers and other curious people Rating: 4 out of 5 stars4/5Python Projects for Beginners: A Ten-Week Bootcamp Approach to Python Programming Rating: 0 out of 5 stars0 ratingsSQL: For Beginners: Your Guide To Easily Learn SQL Programming in 7 Days Rating: 5 out of 5 stars5/5PYTHON: Practical Python Programming For Beginners & Experts With Hands-on Project Rating: 5 out of 5 stars5/5Excel : The Ultimate Comprehensive Step-By-Step Guide to the Basics of Excel Programming: 1 Rating: 5 out of 5 stars5/5Python: For Beginners A Crash Course Guide To Learn Python in 1 Week Rating: 4 out of 5 stars4/5SQL All-in-One For Dummies Rating: 3 out of 5 stars3/5The Little SAS Book: A Primer, Sixth Edition Rating: 5 out of 5 stars5/5Teach Yourself C++ Rating: 4 out of 5 stars4/5Pokemon Go: Guide + 20 Tips and Tricks You Must Read Hints, Tricks, Tips, Secrets, Android, iOS Rating: 5 out of 5 stars5/5Web Designer's Idea Book, Volume 4: Inspiration from the Best Web Design Trends, Themes and Styles Rating: 4 out of 5 stars4/5
Reviews for C# for Beginners
0 ratings0 reviews
Book preview
C# for Beginners - Alex Nordeen
C# for Beginners: Learn in 24 Hours
By Alex Nordeen
Copyright 2021 - All Rights Reserved – Alex Nordeen
ALL RIGHTS RESERVED. No part of this publication may be reproduced or transmitted in any form whatsoever, electronic, or mechanical, including photocopying, recording, or by any informational storage or retrieval system without express written, dated and signed permission from the author.
Table of Contents
Chapter 1: What is .NET Framework
What is the .NET Framework
Different versions of the .Net framework
Chapter 2: Download and Install Visual Studio
Chapter 3: Data Types
Building the first console application
Basic Data Types
Enumeration
Variables and Operators
Flow Control and conditional statements
Arrays
Chapter 4: Class and Object
What are classes and objects
Fields and methods
Access Modifiers
Constructors
Inheritance
Polymorphism
Abstract classes
Interfaces
Chapter 5: Collections
ArrayList
Stack
Queues
Hashtable
Chapter 6: Windows Forms Application
Windows Forms Basics
Hello World in Windows Forms
Adding Controls to a form
Event Handling for Controls
Other Controls
Chapter 7: Database Access
Fundamentals of Database connectivity
Connections in .Net
Accessing data
Inserting Records
Updating Records
Deleting Records
Connecting Controls to Data
Using DataGrids
Chapter 8: File Operations
Basic File I/O Commands
Streams – Reading and Writing to files
Serialization
Chapter 1: What is .NET Framework
The .Net framework is a software development platform developed by Microsoft. The framework was meant to create applications, which would run on the Windows Platform. The first version of the .Net framework was released in the year 2000.
The version was called .Net framework 1.0. The .Net framework has come a long way since then, and the current version is 4.6.1.
The .Net framework can be used to create both - Form based andWeb based applications. Web services can also be developed using the .Net framework.
The framework also supports various programming languages such as Visual Basic and C#. So developers can choose and select the language to develop the required application. In this chapter, you will learn some basics of the .Net framework.
.Net Framework Architecture
The basic architecture of the .Net framework is as shown below.
The architecture of the .Net framework is based on the following key components;
Common Language Runtime - The Common Language Infrastructure
or CLI is a platform on which the .Net programs are executed.
The CLI has the following key features:
Exception Handling - Exceptions are errors which occur when the application is executed.
Examples of exceptions are:
If an application tries to open a file on the local machine, but the file is not present.
If the application tries to fetch some records from a database, but the connection to the database is not valid.
Garbage Collection - Garbage collection is the process of removing unwanted resources when they are no longer required.
Examples of garbage collection are
A File handle which is no longer required. If the application has finished all operations on a file, then the file handle may no longer be required.
The database connection is no longer required. If the application has finished all operations on a database, then the database connection may no longer be required.
Working with Various programming languages –
As noted in an earlier section, a developer can develop an application in a variety of .Net programming languages.
Language - The first level is the programming language itself, the most common ones are VB.Net and C#.
Compiler – There is a compiler which will be separate for each programming language. So underlying the VB.Net language, there will be a separate VB.Net compiler. Similarly for C#, you will have another compiler.
Common Language Interpreter – This is the final layer in .Net which would be used to run a .net program developed in any programming language. So the subsequent compiler will send the program to the CLI layer to run the .Net application.
2) Class Library - The .NET Framework includes a set of standard class libraries. A class library is a collection of methods and functions that can be used for the core purpose.
For example, there is a class library with methods to handle all file level operations. So there is a method which can be used to read the text from a file. Similarly, there is a method to write text to a file.
Most of the methods are split into either the System.* or Microsoft.* namespaces. (The asterisk * just means a reference to all of the methods that fall under the System or Microsoft namespace)
A namespace is a logical separation of methods. We will learn these namespaces more in detail in the subsequent chapters.
Languages - The types of applications that can be built in the .Net framework are classified broadly into the following categories.
WinForms– This is used for developing Forms-based applications, which would run on an end user machine. Notepad is an example of a client-based application.
ASP.Net – This is used for developing web based applications, which are made to run on any browser such as Internet Explorer, Chrome or Firefox.
The Web application would be processed on a server, which would have Internet Information Services Installed.
Internet Information Services or IIS is a Microsoft component which is used to execute an ASP.net application.
The result of the execution is then sent to the client machines, and the output is shown in the browser.
ADO.Net – This technology is used to develop applications to interact with Databases such as Oracle or Microsoft SQL Server.
Different versions of the .Net framework
Below is the table of .Net framework versions, which have been released with their release dates. Every version has relevant changes to the framework.
For example, in framework 3.5 and onwards a key framework called the Entity framework was released. This framework is used to change the approach in which the applications are developed while working with databases.
The biggest advantage of the .Net framework is that it supports Windows platform. Almost everyone works with Windows machines.
Microsoft always ensures that .Net frameworks are in compliance with all the supported Windows operating systems.
The following design principles of the .Net framework is what makes it very relevant to create .Net based applications.
Interoperability - The .Net framework provides a lot of backward support. Suppose if you had an application built on an older version of the .Net framework, say 2.0. And if you tried to run the same application on a machine which had the higher version of the .Net framework, say 3.5. The application would still work. This is because with every release, Microsoft ensures that older framework versions gel well with the latest version.
Portability- Applications built on the .Net framework can be made to work on any Windows platform. And now in recent times, Microsoft is also envisioning to make Microsoft products work on other platforms, such asiOSand Linux.
Security - The .NET Framework has a good security mechanism. The in-built security mechanism helps in both validation and verification of applications. Every application can explicitly define their security mechanism. Each security mechanism is used to grant the user access to the code or to the running program.
Memory management - The Common Language runtime does all the work or memory management. The .Net framework has all the capability to see those resources, which are not used by a running program. It would then release those resources accordingly. This is done via a program called the Garbage Collector
which runs as part of the .Net framework.
The garbage collector runs at regular intervals and keeps on checking which system resources are not utilized, and frees them accordingly.
Simplified deployment - The .Net framework also have tools, which can be used