Introduction to C#
Programming
Prepared by: Aileen Dela Torre
Week 3 Topic:
•Introduction to C# Programming
Logic Formulation
• History
• Installations
• IDE (Integrated Development Environment)
• Basic Syntax
• Simple I/O
C# Overview
• Pronounced as “C-sharp”
• C# is a simple, modern, general-purpose,
object-oriented programming language
developed by Microsoft in the warly 2000s
as part of its .NET initiative led by Anders
Hejlsberg.
• It combines the power and flexibility of C+
+ with the simplicity of Visual Basic.
C# Overview
• C# is known for its robustness, rich library,
and support for diverse programming
paradigms.
• This tutorial will teach you basic C#
programming and will also take you
through various advanced concepts related
to C# programming language.
History of C#
• C# is a modern, general-purpose, object-oriented
programming language developed by Microsoft and
approved by European Computer Manufacturers
Association (ECMA) and International Organization for
Standardization (ISO).
• C# was developed by Anders Hejlsberg and his team
during the development of .Net Framework.
• C# programming is very much based on C and C++
programming languages, so if you have a basic
understanding of C or C++ programming, then it will be
fun to learn C#.
Introduction to C#
• It is a modern, general-purpose programming
language
• It is object oriented.
• It is component oriented.
• It is easy to learn.
• It is a structured language.
• It produces efficient programs.
• It can be compiled on a variety of computer
platforms.
• It is a part of .Net Framework
The .NET Framework
• The .Net framework is a revolutionary platform that helps you
to write the following types of applications −
• Windows applications
• Web applications
• Web services
• The .Net framework applications are multi-platform
applications.
• The framework has been designed in such a way that it can be
used from any of the following languages: C#, C++, Visual
Basic, Jscript, COBOL, etc. All these languages can access the
framework as well as communicate with each other.
Integrated Development
Environment (IDE)
• SharpDevelop 5.1
- open-source IDE for the .NET platform.
With it, you can edit code in various
languages, including C#, [Link], F#,
IronPython and IronRuby, as well as [Link]
MVC and WCF.
Basic Structure
• Using Directives: Similar to headers in C, these
directives allow the use of classes from
namespace.
• namespace Declaration: A way to organize
code and prevent name conflicts.
• class Definition: Defines a new type.
• main() Method: The entry point of the program
where execution begins.
• statements: Commands to be executed,
enclosed within methods.
It is worth to note the following
points −
• Case Sensitivity: C# is case sensitive.
• Semicolons: All statements and expression
must end with a semicolon (;).
• Braces: Used to define the scope of classes and
methods.
• The program execution starts at the Main
method.
• Unlike Java, program file name could be different
from the class name.
using System;
Sample
Input/Out namespace HelloWorldApplication
put {
class HelloWorld {
(Strings) static void Main(string[] args) {
string testString;
[Link]("Enter a string - ");
testString = [Link]();
[Link]("You entered
'{0}'", testString);
[Link]();
}
}
}