C# PDF
C# PDF
C# PDF
A framework, or software framework, is a platform that provides a foundation for developing software applications. Think of it as a
template of a working program that can be selectively modified by adding code. It uses shared resources – such as libraries, image
files, and reference documents – and puts them together in one package. That package can be modified to suit the specific needs of
the project. With a framework, the developer can add or replace features to give new functionality to the application.
Types of frameworks:
With the huge variety of programming languages out there, naturally, you’ll find that there are a large number of frameworks
available. Each of these frameworks is used to solve different problems that come up in the process of software development. They’re
used in many industries, including web development, data science, and more. Here, we’ll go into some of the broader categories of
frameworks with examples of specific frameworks within them.
Back-end web frameworks, or just web frameworks, are the most commonly used programming frameworks. But what are web
frameworks? Web frameworks assist developers in making web applications and dynamic websites. These frameworks completely
transformed the way web development is done, speeding up the entire software development process by automating common tasks for
web developers, like providing database access, session management, and page templates. Instead of building websites using HTML,
JavaScript and CSS, back-end frameworks use programming languages to interact with a database to generate content. This means that
this work is hosted on a server, hence why it’s the back-end portion. Common back-end web frameworks include.
Django – an open-source Python web development framework. It was designed to “help developers take applications from concept
to completion as quickly as possible”. A popular choice due to its speed, security, and scalability.
Instagram
Django Python Pinterest
Coursera
MySpace
ExpressJS NodeJS GeekList
Storify
Deltanet Travel
Laravel PHP Neighborhood Lender
MyRank
ZendDesk
Ruby on Rails Ruby Shopify
GitHub
Mapme
CakePHP PHP Educationunlimited
Followmy Tv
Front-End Frameworks:
Where back-end web frameworks are loaded on a server, front-end frameworks are executed in a user’s browser. They allow web
developers to design what the users see on the website, things like the management of AJAX requests, defining file structures, and
styling the website’s components.
With the rise of mobile rapidly gaining traction, mobile development frameworks have seen an equally impressive uptick. Like their
desktop counterparts, mobile development frameworks give developers a structure that supports the mobile app-building process.
They can be split into two different types, native mobile apps (meaning the app would be built for either Apple or Android) and cross-
platform frameworks (resulting in an app that’s compatible with any phone). Common mobile development frameworks are:
Flutter – A cross-platform app framework that forms native code, meaning you can use one programming language and code base to
create an app for both Apple and Android. It was developed by Google and is free and open-source.
React Native – A cross-platform app framework that also forms a native code developed by the team at Facebook. It was created with
both JavaScript and ReactJS programming languages and comes with ready-made components that can save developers time as they
don’t have to create elements from scratch.
b) Save Time
c) In this, security features are already made, due to which the application is more secure and we do not need to worry about security.
d) Many features library, helpers, controllers are already present which make software development task easy like making URL SEO
friendly.
e) In this, different sections are made for all the tasks, due to which it is very easy to write and understand the code.
h) Clean code
3. .Net Languages
1. CLR (Common Language Run-time):- It works like a virtual machine, and executes all the languages. CLR translates the source
code into byte code, which we call CIL (Common Intermediate Language) or MSIL (Microsoft Intermediate Language). And after
that converts this CIL code or MSIL code into native code by JIT compiler at run-time.
2. FCS (Framework Class Library):-FCL is Microsoft's standard library, and it is a reusable, class, interfaces library. It can
be used for web-based, Windows GUI applications and ASP. Net application, used to develop console-based application goes.
Different types of application
1. Embedded Systems
2. Windows applications (also called 'Desktop applications')
3. Web Applications
4. Web Services
5. Console applications
Embedded Systems
When we save a name, address and other information in to our Mobile Phone or Digital Diary, you know How it gets saved in it?
Nothing but which is a small computer program 'Embedded' into a chip in the device inside the mobile phone or digital diary known as
Embedded Systems.
Windows applications
Windows Applications is a form based standard Windows, Microsoft word; Paint is example to the Windows application, and also
called 'Desktop applications'.
Web Applications
A web site is also called 'web Applications'. A web application is a collection of web pages hosted on a special computer called 'web
server'. Web server can be located anywhere and visitors can be located anywhere. It will work through Browsers (EG. Internet
Explorer, Mozilla, Netscape).
Web Services
Web services are web applications that give services to other applications through the internet, example Google search engine, Yahoo
Search engine etc. which allows other applications to delegate the task of searching over the internet.
Console Applications
Console applications runs inside the command prompt i.e. DOS window, It is a light weight program and which is used commonly for
test applications.
Web Application
a) A web application or web app is a type of software program that is created to accomplish a specific task.
b) This web application is stored on the web server and whenever the user or client sends a request, this application is executed
on the client's web browser.
c) Like any other computer software or application, this application provides its user with an environment where data is entered
by the user.
f) This includes server-side scripting languages such as: PHP, ASP, etc.
g) This includes client-side scripting languages such as: HTML, jQuery, JavaScript, etc.
Role of web server and web browser
Object Orientation
The object-oriented approach, however, focuses on objects that represent abstract or concrete things in the real world. These objects
are first defined by their character and their properties, which are represented by their internal structure and their attributes (data). The
behavior of these objects is described by methods (functions).
MSIL (Microsoft Intermediate Language)
Whenever you compile a C# program, direct machine code is not generated. Rather a pseudo code is generated, which is called MSIL.
It is similar to the byte code of java. Which is later converted and machine code is generated.
First C# Program
C# can be used in a window-based, web-based, or console application. To start with, we will create a console application to work with
C#.
Open Visual Studio installed on your local machine. Click on File -> New Project... from the top menu, as shown below.
From the New Project popup, shown below, select Visual C# in the left side panel and select the Console App in the right-side panel.
In the name section, give any appropriate project name, a location where you want to create all the project files, and the name of the
project solution.
Program.cs will be created as default a C# file in Visual Studio where you can write your C# code in Program class, as shown below.
(The .cs is a file extension for C# file.)
Every console application starts from the Main() method of the Program class.
Note:
Every line or statement in C# must end with a semicolon (;).
Output:
Hello World!!
Modifier Keywords
Modifier keywords
abstract
async
const
event
extern
new
override
partial
readonly
sealed
Modifier keywords
static
unsafe
virtual
volatile
Access
Modifiers Usage
public The Public modifier allows any part of the program in the same assembly or another assembly to access the type
and its members.
private The Private modifier restricts other parts of the program from accessing the type and its members. Only code in
the same class or struct can access it.
internal The Internal modifier allows other program code in the same assembly to access the type or its members. This is
default access modifiers if no modifier is specified.
protected The Protected modifier allows codes in the same class or a class that derives from that class to access the type or
its members.
Statement Keywords
Statement Keywords
if
else
switch
case
do
for
foreach
in
while
break
continue
default
goto
return
Statement Keywords
yield
throw
try
catch
finally
checked
unchecked
fixed
lock
params
ref
out
Namespace Keywords
These keywords are applied with namespace and related operators.
Namespace Keywords
using
. operator
:: operator
extern alias
Operator Keywords
Operator keywords perform miscellaneous actions
Operator Keywords
as
await
is
new
sizeof
typeof
stackalloc
checked
unchecked
Access Keywords
Access keywords are used to access the containing class or the base class of an object or class.
Access keywords
base
this
Literal Keywords
Literal keywords apply to the current instance or value of an object.
Literal Keywords
null
false
true
value
void
Type Keywords
Type keywords are used for data types.
Type keywords
bool
byte
char
class
decimal
double
enum
float
int
long
sbyte
short
string
struct
uint
ulong
ushort
Contextual Keywords
Contextual keywords are considered as keywords, only if used in specific contexts. They are not
reserved and so can be used as names or identifiers.
Contextual Keywords
add
var
dynamic
global
set
value
Contextual keywords are not converted into blue color (default color for keywords in visual studio)
when used as an identifier in Visual Studio. For example, var in the below figure is not in blue,
whereas the color of this is the blue color. So var is a contextual keyword
Query Keywords
Query keywords are contextual keywords used in LINQ queries.
Query Keywords
from
where
select
group
into
orderby
join
let
in
on
equals
by
ascending
descending
Example: Use Keyword as Identifier
using System;
Console.WriteLine(@class.MyNum);
}
}
Object-oriented programming, a class defines some properties, fields, events, methods, etc. A class defines the
kinds of data and the functionality their objects will have.
Define a Class
class Student
{
A class can contain one or more constructors, fields, methods, properties, delegates, and events. They are called
class members. A class and its members can have access modifiers such as public, private, protected, and
internal, to restrict access from other parts of the program.
Add different members to the Student class
Field: A class can have one or more fields. It is a class-level variable that holds a value. Generally, field
members should have a private access modifier used with property.
Eg.
class Student
{
public int id;