Lecturer: Mukhtar Mohamed Ali “Hakaale”

Slides:



Advertisements
Similar presentations
Computer and Programming
Advertisements

INTRODUCTION Chapter 1 1. Java CPSC 1100 University of Tennessee at Chattanooga 2  Difference between Visual Logic & Java  Lots  Visual Logic Flowcharts.
Creating a Program In today’s lesson we will look at: what programming is different types of programs how we create a program installing an IDE to get.
Your First C++ Program Aug 27, /27/08 CS 150 Introduction to Computer Science I C++  Based on the C programming language  One of today’s most.
How to Create a Java program CS115 Fall George Koutsogiannakis.
Introduction to the C# Programming Language for the VB Programmer.
Programming Introduction November 9 Unit 7. What is Programming? Besides being a huge industry? Programming is the process used to write computer programs.
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
 To be able to write larger programs ◦ By breaking them down into smaller parts and passing data between the parts.  To understand the concepts of Methods.
Computer Science A 1: 3/2. Course plan Introduction to programming Basic concepts of typical programming languages. Tools: compiler, editor, integrated.
Tahir Nawaz Visual Programming C# Week 2. What is C#? C# (pronounced "C sharp") is an object- oriented language that is used to build applications for.
Assembler Compiler Interpreter ASSEMBLER To convert the assembly language into machine code. Translate mnemonic operation codes to their machine language.
Programming a computer. What does programming a computer mean ? Programming a computer: Since a computer can only execute machine instructions (encoded.
Unit 2: Java Introduction to Programming 2.1 Initial Example.
Object Oriented Software Development
A First Program Using C#
Introduction to Java Appendix A. Appendix A: Introduction to Java2 Chapter Objectives To understand the essentials of object-oriented programming in Java.
Neal Stublen Overview of.NET Windows Applications Microsoft Windows OS / Intel Platform Windows Application File SystemNetworkDisplay.
Advanced Java New York University School of Continuing and Professional Studies.
11 Getting Started with C# Chapter Objectives You will be able to: 1. Say in general terms how C# differs from C. 2. Create, compile, and run a.
Neal Stublen Class Objectives  Develop an understanding of the.NET Framework  Gain proficiency using Visual Studio  Begin learning.
Chapter 1: A First Program Using C#. Programming Computer program – A set of instructions that tells a computer what to do – Also called software Software.
Lecture 1 Programming in C# Introducing C# Writing a C# Program.
11 A First Game Program Session Session Overview  Begin the creation of an arcade game  Learn software design techniques that apply to any form.
Distributed Systems (236351) Tutorial 1 - Getting Started with Visual Studio C#.NET.
Session One Introduction. Personal Introduction Role of programmers Robot Examination HUD & HID Uploading Code.
Applied Computing Technology Laboratory QuickStart C# Learning to Program in C# Amy Roberge & John Linehan November 7, 2005.
Getting Started with C# August 29, NET Concepts Language Independence Language Integration  your C# program can use a class written in VB Program.
1 C++ Programming Basics Chapter 1 Lecture CSIS 10A.
Microsoft Visual Basic 2005 BASICS Lesson 1 A First Look at Microsoft Visual Basic.
CSC 110 Using Python [Reading: chapter 1] CSC 110 B 1.
JAVA Practical Creating our first program 2. Source code file 3. Class file 4. Understanding the different parts of our program 5. Escape characters.
22-July-2002cse142-13B-Development © 2002 University of Washington1 Development Tools CSE 142, Summer 2002 Computer Programming 1
1 Class 1 Lecture Topic Concepts, Definitions and Examples.
11 Computers, C#, XNA, and You Session 1.1. Session Overview  Find out what computers are all about ...and what makes a great programmer  Discover.
Object Oriented Programming Session # 03.  Abstraction: Process of forming of general and relevant information from a complex scenarios.  Encapsulation:
1 Introduction to Object Oriented Programming Chapter 10.
Execution ways of program References: www. en.wikipedia.org/wiki/Integrated_development_environment  You can execute or run a simple java program with.
Quiz 1 A sample quiz 1 is linked to the grading page on the course web site. Everything up to and including this Friday’s lecture except that conditionals.
Tutorial 1 Writing Your First C++ Program CSC1110C Introduction to Computer Programming By Paul Pun Acknowledgement: Special thanks to Dr. Michael Fung.
Introduction to Algorithm. What is Algorithm? an algorithm is any well-defined computational procedure that takes some value, or set of values, as input.
Introduction to Object Oriented
C# Diline Giriş.
The Object-Oriented Thought Process Chapter 03
Lecture 1b- Introduction
Lecture 2 D&D Chapter 2 & Intro to Eclipse IDE Date.
INF230 Basics in C# Programming
Prof: Dr. Shu-Ching Chen TA: Samira Pouyanfar Spring 2017
Concepts of Object Oriented Programming
© 2016, Mike Murach & Associates, Inc.
Overview of c# Programming
Java Applet Programming Barry Sosinsky Valda Hilley
Welcome to Visual Programming using C#
Looking at our “Getting Started” application
Text by: Lambert and Osborne
RAD Certification Checkpoint #2 Introducing RadStudio (Hello World)
C# and the .NET Framework
Tutorial C#.
© 2016, Mike Murach & Associates, Inc.
Hands-on Introduction to Visual Basic .NET
Advanced Programming Lecture 02: Introduction to C# Apps
Unit 1: Introduction Lesson 1: PArts of a java program
Lesson 16: Functions with Return Values
Chapter 3 – Introduction to C# Programming
Chap 1 Chap 2 Chap 3 Chap 5 Surprise Me
Tonga Institute of Higher Education
CISC124 Labs start this week in JEFF 155. Fall 2018
Beginning Style 27-Feb-19.
The Role of Command Line Compiler (csc.exe)
Chapter 2 part #1 C++ Program Structure
Presentation transcript:

Lecturer: Mukhtar Mohamed Ali “Hakaale” Introduction to C# Lecturer: Mukhtar Mohamed Ali “Hakaale”

Introduction Welcome to the C#. With the introduction of the .NET framework, Microsoft included a new language called C# (pronounced C Sharp). C# is designed to be a simple, modern, general-purpose, object-oriented programming language, borrowing key concepts from several other languages, most notably Java. 

Cont.. C# could theoretically be compiled to machine code, but in real life, it's always used in combination with the .NET framework. Therefore, applications written in C#, requires the .NET framework to be installed on the computer running the application. While the .NET framework makes it possible to use a wide range of languages, C# is sometimes referred to as THE .NET language, perhaps because it was designed together with the framework.  C# is an Object Oriented language and does not offer global variables or functions. Everything is wrapped in classes, even simple types like int and string, which inherits from the System.Object class. 

Visual C# Express C# can be written with any text editor, like Windows Notepad, and then compiled with the C# Command line compiler, csc.exe, which comes with the .NET framework. However, most people prefer to use an IDE (Integrated Development Environment), and Microsoft offers several options for this. Their flagship is Visual Studio, which can be used to work on every possible aspect of the .NET framework. This product is very advanced, and comes in several editions. Visual Studio is not exactly cheap, and might even be too advanced for hobby programmers.  For C# programming, you should download the Visual C# Express from http://www.microsoft.com/express/download/. Install it, and you're ready to write your first C# application!

First App (Hello, world!) If you have ever learned a programming language, you know that they all start with the "Hello, world!" example, and who are we to break such a fine tradition? Start Visual C# Express (introduced in the last chapter), and select File -> New project… From the project dialog, select the Console application. This is the most basic application type on a Windows system, but don't worry, we won't stay here for long. Once you click Ok, Visual C# Express creates a new project for you, including a file called Program.cs. This is where all the fun is, and it should look something like this: 

Cont …

Hello world explained using is a keyword, highlighted with blue by the editor. The using keyword imports a namespace, and a namespace is a collection of classes. Classes brings us some sort of functionality, and when working with an advanced IDE like Visual C# Express, it will usually create parts of the trivial code for us. 

Cont … As you can see, we even get our own namespace: The namespace ConsoleApplication1 is now the main namespace for this application, and new classes will be a part of it by default. Obviously, you can change this, and create classes in another namespace. In that case, you will have to import this new namespace to use it in your application, with the using statement, like any other namespace.  Next, we define our class. Since C# is truly an Object Oriented language, every line of code that actually does something, is wrapped inside a class. In the case, the class is simply called Program:

We can have more classes, even in the same file We can have more classes, even in the same file. For now, we only need one class. A class can contain several variables, properties and methods, concepts we will go deeper into later on. For now, all you need to know is that our current class only contains one method and nothing else. It's declared like this: This line is probably the most complicated one in this example, so let's split it up a bit. The first word is static. The static keyword tells us that this method should be accesible without instantiating the class, but more about this in our chapter about classes. 

Cont … The next keyword is void, and tells us what this method should return. For instance, int could be an integer or a string of text, but in this case, we don't want our method to return anything, or void, which is the same as no type.  The next word is Main, which is simply the name of our method. This method is the so-called entry-point of our application, that is, the first piece of code to be executed, and in our example, the only piece to be executed.