CIT304 Chapter 2 Y24
CIT304 Chapter 2 Y24
CIT304 Chapter 2 Y24
Introduction to C#
Adedoyin I. OYEBADE
sacnet2015@gmail.com
Bowen University,
Iwo, Nigeria
April 3, 2023
1 .Net Framework
Introduction .Net Framework
.Net Framework Components
.Net Framework Components
.NET Framework Class Library Namespaces
C# Programming
C# Features
C# Program Sample
C# Using System
4 System.IO, System.DirectoryServices,
System.IO.IsolatedStorage:
• These are used to access, read and write files
1 System.Diagnostics
• It is used to debug and trace the execution of an application.
2 System.Windows.Forms,System.Windows.Forms.Design
• These namespaces are used to create Windows-based
applications using Windows user interface components.
2 Simple:
• C# is a simple language in the sense that it provides structured
approach (to break the problem into parts), rich set of library
functions, data types etc.
4 Object oriented:
• C# is object oriented programming language. OOPs makes
development and maintenance easier where as in
Procedure-oriented programming language it is not easy to
manage if code grows as project size grow.
2 Type safe:
• C# type safe code can only access the memory location that it
has permission to execute. Therefore it improves a security of
the program.
3 Interoperability:
• Interoperability process enables the C# programs to do almost
anything that a native C++ application can do
2 Component oriented:
• C# is component oriented programming language. It is the
predominant software development methodology used to
develop more robust and highly scalable applications.
4 Rich Library:
• C# provides a lot of inbuilt functions that makes the
development fast. Fast speed: The compilation and execution
time of C# language is fast
class Program {
static void Main(string[] args) {
System.Console.WriteLine(”Hello World”)
}
}
1 Class
• is a keyword which is used to define class
2 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.
3 static
• is a keyword which means object is not required to access static
members. So it saves memory
4 void
• is the return type of the method. It does’t return any value. In
such case, return statement is not required.
1 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.
2 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.
3 System.Console.WriteLine(”Hello World!”):
• 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.
1 using System
• it means we don’t need to specify System namespace for
accessing any class of this namespace.
• we are using Console class without specifying System.Console.
using System;
class Program {
static void Main(string[] args) {
Console.WriteLine(”Hello World”);
}
}
1 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”);
}
}}