Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
12 views

Intro To C# For Visual Programming Lab

C# is an object-oriented programming language that is used to develop various types of applications that run on the .NET Framework. It includes features like inheritance, polymorphism, and exception handling. The Common Language Runtime (CLR) converts C# code into an intermediate language and manages its execution. A simple "Hello World" program in C# prints the message using the Console.WriteLine method in the System namespace.

Uploaded by

Alina Alina
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

Intro To C# For Visual Programming Lab

C# is an object-oriented programming language that is used to develop various types of applications that run on the .NET Framework. It includes features like inheritance, polymorphism, and exception handling. The Common Language Runtime (CLR) converts C# code into an intermediate language and manages its execution. A simple "Hello World" program in C# prints the message using the Console.WriteLine method in the System namespace.

Uploaded by

Alina Alina
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 16

C# Basics

Programs
Visual Programming
Intro….
• C# is a programming language of .Net Framework.
• C# includes all topics of C# such as first example, control statements,
objects and classes, inheritance, constructor, destructor, this, static,
sealed, polymorphism, abstraction, abstract class, interface,
namespace, encapsulation, properties, indexer, arrays, strings, regex,
exception handling, multithreading, File IO, Collections etc.
What is C#
• C# is pronounced as "C-Sharp". It is an object-oriented programming
language provided by Microsoft that runs on .Net Framework.
• By the help of C# programming language, we can develop different types
of secured applications..
• Distributed applications (A distributed application is a program that runs
on more than one computer and communicates through a network.
Example : For example, web browsers are distributed applications.
Browsers require back-end software (servers on the World Wide Web
as well as front-end software installed on your workstation (e.g.,
Internet Explorer))
• Web service applications (Web services are self-contained,
modular applications that can be described, published, located, and
invoked over a network)
• Common Language Runtime (CLR) is a managed execution
environment that is part of Microsoft's . NET framework. CLR
manages the execution of programs written in different
supported languages.
• CLR transforms source code into a form of byte code known as
Common Intermediate Language (CIL)
C# Example: Hello World

• In C# programming language, a simple "hello world" program can be


written by multiple ways. Let's see the top 4 ways to create a simple
C# example:
• Simple Example
• Using System
• Using public modifier
• Using namespace
C# Simple Example

• class Program
• {
• static void Main(string[] args)
• {
• System.Console.WriteLine("Hello World!");
• }
• }

• Output:
Hello World!
Description
• class: is a keyword which is used to define class.
• Program: is the class name. A class is a blueprint or template from which objects are created.
It can have data members and methods. Here, it has only Main method.
• static: is a keyword which means object is not required to access static members. So it saves
memory.
• void: is the return type of the method. It does't return any value. In such case, return
statement is not required.
• Main: is the method name. It is the entry point for any C# program. Whenever we run the C#
program, Main() method is invoked first before any other method. It represents start up of the
program.
• string[] args: is used for command line arguments in C#. While running the C# program, we
can pass values. These values are known as arguments which we can use in the program.
• System.Console.WriteLine("Hello World!"): Here, System is the namespace. Console is the
class defined in System namespace. The WriteLine() is the static method of Console class
which is used to write the text on the console
C# Example: Using System

• If we write using System before the class, it means we don't need to specify System namespace for
accessing any class of this namespace. Here, we are using Console class without specifying
System.Console.
• using System;
• class Program
• {
• static void Main(string[] args)
• {
• Console.WriteLine("Hello World!");
• }
• }
• Output:

• Hello World!
C# Example: Using public modifier

• We can also specify public modifier before class and Main() method. Now, it can be accessed
from outside the class also.
• using System;
• public class Program
• {
• public static void Main(string[] args)
• {
• Console.WriteLine("Hello World!");
• }
• }
• Output:
• Hello World!
C# Example: Using namespace

• We can create classes inside the namespace. It is used to group related classes. It is used to categorize
classes so that it can be easy to maintain.
• using System;
• namespace ConsoleApplication1
• {
• public class Program
• {
• public static void Main(string[] args)
• {
• Console.WriteLine("Hello World!");
• }
• }
• }
.NET Framework

• .NET is a framework to develop software applications. It is designed


and developed by Microsoft and the first beta version released in
2000.
• It is used to develop applications for web, Windows, phone.
Moreover, it provides a broad range of functionalities and support.
• This framework contains a large number of class libraries known as
Framework Class Library (FCL). The software programs written in .NET
are executed in the execution environment, which is called CLR
(Common Language Runtime). These are the core and essential parts
of the .NET framework.
• this framework provides various services like memory management,
networking, security, memory management, and type-safety.
• The .Net Framework supports more than 60 programming languages
such as C#, VB.NET, J#, JScript.NET, COBOL, Perl, ML, Pascal, Python,
Cobra, etc.
CLR (Common Language Runtime)

• It is a program execution engine that loads and executes the program.


It converts the program into native code/machine code .
• It acts as an interface between the framework and operating system.
• It does exception handling, memory management, and garbage
collection.
• Moreover, it provides security, type-safety, interoperability, and
portablility
FCL (Framework Class Library)

• It is a standard library that is a collection of thousands of classes and


used to build an application. The BCL (Base Class Library) is the core of
the FCL and provides basic functionalities.
• WinForms
• Windows Forms is a smart client technology for the .NET Framework, a set of managed
libraries that simplify common application tasks such as reading and writing to the file
system.
• ASP.NET
• ASP.NET is a web framework designed and developed by Microsoft. It is used to develop
websites, web applications, and web services. It provides a fantastic integration of HTML,
CSS, and JavaScript. It was first released in January 2002.
• ADO.NET
• ADO.NET is a module of .Net Framework, which is used to establish a connection between
application and data sources. Data sources can be such as SQL Server and XML. ADO .NET
consists of classes that can be used to connect, retrieve, insert, and delete data.

You might also like