C# Materila
C# Materila
C# Materila
COMPILED BY
PROF. HARLIN SHEEBA M
Unit-1
Introduction to .Net Technologies
JavaScript: JavaScript
It is a high-level programming language that is used to add dynamic interactivity to web pages. It can be
used to create interactive effects, such as dropdown menus, pop-ups, and more. JavaScript can also be
used to create complex applications. such as online shopping carts, social networks and more. JavaScript
is an essential part of modern web development and is supported by all major web browsers.
IP Address
An IP (Internet Protocol) address is a unique numerical label assigned to every device connected to the
internet. An IP address consists of four numbers separated by periods such as 192.168.1.1.
There are two main types of IP addresses: IPv4 (Internet Protocol version 4) and IPv6 (Internet Protocol
version 6). IPv4 uses 32-bit addresses and is the most commonly used type. while IPV6 uses 128-bit
addresses and is gradually being adopted to replace IPV'4 due to the depletion of available IPv4 addresses.
Web Browsers
A web browser is a software application that allows users to access, retrieve and display information on
the World Wide Web (WWW). It is the primary tool used by individuals to access and interact with
websites and Other online resources.
Examples: • Internet Explorer
• Mozilla Firefox
• Google Chrome
• Microsoft Edge
When a user enters a URL into the browser, the browser sends an HTTP request to the server hosting the
website. The server then sends back an HTTP response.
It also provides a user-friendly interface and additional features, such as bookmarks, tabs, and history, to
make navigating the web easier and more efficient.
Web Server
A web server is a computer that stores, processes, and delivers website files to web browsers. A web server
is a computer system capable of delivery web content to end users over the internet via a web browser. A
web server is software that runs on the web site hosting Server computer. Its main purpose is to serve web
pages, which means it waits for requests from web browsers (also known as clients) and responds by
sending the required data back.
website
A website has a unique domain name, and we can access it by entering that domain name in the URL A
website is a collection of webpages that are under one domain. One website will have several webpages
like Home, About Us, Contact Us, Services, Products, etc. All of these pages together make up a website.
In other words, a webpage is an independent page of a website.
Example: https://www.amazon.in
Types of website
Static Website: A static website contains Web pages with fixed content. Each webpage displays the same
information to every user. Static sites are the most basic type of website and are the easiest to create.
Example: Common examples of static websites include resume websites, portfolio websites, brochure
websites, one-off landing pages, and other informational or read-only sites.
Dynamic Website: A dynamic website is a website that displays different types of content every time
a user view it. This display changes depending on a number of factors like viewer demographics, time of
day, location.
Example: login & signup pages, application & submission forms, inquiry and shopping cart pages.
Client-Side Dynamic Website or Webpage: These web pages are created using Client-side scripting.
These pages get changed in response to actions that occur within that page, such as mouse or keyboard
action. Scripting languages such as JavaScript, Dart, etc., can be used for client-Side scripting.
Web Development
Web development refers to the process of designing, creating, and maintaining websites and web
applications. It encompasses various aspects of web design, programming, and technology to build
functional, visually appealing, and user-friendly websites and web applications.
HTML Versions
HTML has progressed and evolved over time, new versions of the language have been released to
introduce the new features.
Initially, the HTML was released in the year of 1993 and developed by Tim Berners-Lee in 1990.
The current HTML5 version has gained so much popularity because of its newly added features in it.
Disadvantages or HTML
• Limited Interactivity: HTML provides only limited interactivity, and its static nature can make
it difficult to create dynamic and interactive web pages. To overcome this limitation web
developers often have to use additional technologies such as JavaScript and CSS.
• Complexity: As the web has evolved, HTML has become more complex, with a growing number
of tags and attributes that web developers need to learn and understand. This complexity can make
it challenging for new web developers to get started with HTML. and it can also lead to poorly
designed and inconsistent web pages.
• Browser Compatibility issue: Different web browsers can interpret HTML differently, and this
can lead to compatibility issues that can affect the appearance and functionality of web/ pages. To
overcome these issues, web developers need to test their web pages in multiple browsers and make
adjustments as needed.
Structure of HTML
Heading tags
Any document starts with a heading. You can use different sizes for your headings.
HTML also has six levels of headings, which use the elements <h1>, <h2>, <h3>,
<h4>, <h5>, and <h6>. While displaying any heading, browser adds one line before
and one line after that heading.
Scripts
In web development, the scripts are used to create client-side features and server-side features for a web
application. These features work together to create a whole application that appeals to end users and work
efficiently.
▪ A Script is a list of instruction to tell another program what to do.
▪ A script does not need the compilation step but it is interpreted one by one at runtime.
▪ The scripting languages are interpreted languages which directly executed without requiring
to be complied into machine language program
▪ Examples : VBScript, JavaScript, ASP, PHP etc.
.NET Framework
.NET is an open source developer platform used for building many different type of application.
▪ It consist of developer tools, programming languages and libraries to build desktop, web
application, websites and web services and also games.
▪ It is designed and developed by Microsoft and the first version was released in the year
2002(.NET Framework 1.0).
▪ This framework provides various services like memory management, networking, security,
memory management, and type-safety
Framework Class Library (FCL) is a standard library that is a collection of thousands of classes are
used to build an application. The Framework Class Library or FCL provides the system functionality
in the .NET Framework as it has various classes, data types, interface.
Namespaces in the Framework Class Library are a group of related classes and interfaces that can be
used by all the .NET framework languages.
In other languages such as C, we use header files, in java we use package similarly we use "using
system" in .NET, where using is a keyword and system is a namespace.
Just-In-Time Compiler(JlT) is a part of Common Language Runtime (CLR) in .NET which is responsible
for managing the execution of .NET programs regardless of any .NET programming language.
A language specific compiler converts the source code to the intermediate language (IL) or Microsoft
Intermediate Language (MSIL).
This intermediate language (IL) is then converted into the machine code by the Just-in-Time (JIT)
compiler.
There are three types of JIT compilation
Normal JIT Compilation With the Normal JIT Compiler methods are compiled when called at runtime
after execution this method is stored in the memory.
Econo JIT Compilation It compiles methods when called at runtime and removes them from memory
after execution.
Pre-JIT Compilation All the source code is compiled into the machine code at the same time in a single
compilation cycle using the Pre-JIT Compiler.
Features of .NET
1. Common Language Runtime
2. Common Type System
3. Language Interoperability
4. Multi Language Support
5. Security
6. Memory Management
7. Version Compatibility
8. Easy and Rich Debugging Support
9. Simplified Development
10. Framework Class Library
C# (C-Sharp) :
C# (C-Sharp) is object-oriented programming language created by Microsoft that runs on the .NET
Framework.
C# has roots from the C family, and the language is close to other popular languages like C++ and Java.
❖ Mobile applications
❖ Desktop applications
❖ Web applications
❖ Web services
❖ Games
❖ Database applications
➢ Namespace declaration
➢ A class
➢ Class methods
➢ Class attributes
➢ A Main method
➢ Comment
C# program Structure:
➢ C# Comments: Comments can be used to explain C# code, and to make it more readable. It can also
be used to prevent execution when testing alternative code.
❖ Multi-line comments start with /* and ends with */. (will not be executed).
➢ C# Identifiers: Identifiers are descriptive names in order to create understandable and maintainable
code.
The general rules for naming Identifiers/variables are:
❖ Names can contain letters, digits and the underscore character (_)
❖ Names should start with a lowercase letter and it cannot contain whitespace
❖ Names are case sensitive ("myVar" and "myvar" are different variables)
❖ Reserved words (like C# keywords, such as int or double) cannot be used as names
C# program Structure:
➢ C# Variables: Variables are containers for storing data values. All C# variables must be identified with
unique names.
➢ C# Constants: The const keyword is useful when you want a variable to always store the same value.
Example: const int Num = 15;
Num = 20; // error
➢ Display Variables: The WriteLine() method is often used to display variable values to the console
window. To combine both text and a variable, use the + character:
Example: string name = "John"; Console.WriteLine("Hello " + name);
Features of C#
Applications of C#
C# can be used in various applications supported by .NET
• Console applications • Cloud native apps and
services
• Windows libraries and components • Developing ASP.NET
projects
• Web applications • Web services and Web
API
• Developing Windows controls • Native iOS and Android
mobile apps
• Creating Web controls • Windows services
C# Language Fundamentals
C# Tokens: all the characters of a C# program are grouped into a symbol called token.
1. Identifiers – case sensitive names used by programmers to identify variables,
methods, classes and objects.
2. Keywords – it appears in lowercase and cannot be used as identifiers.
3. Operators – these are symbols that represent arithmetic, relational, assignment
and logical operations. They operate on operands and return result.
4. Punctuators – it is used to divide a program into segments ( , { } )
5. Literals – specific types of data explicitly entered into code.