Overview of c# Programming

Slides:



Advertisements
Similar presentations
Variables in C Amir Haider Lecturer.
Advertisements

Introduction to PHP MIS 3501, Fall 2014 Jeremy Shafer
IT151: Introduction to Programming
University of Palestine software engineering department Introduction to data structures Introduction to java application instructor: Tasneem Darwish.
Introduction to C Programming
1 Chapter 2 Introduction to Java Applications Introduction Java application programming Display ____________________ Obtain information from the.
1 Outline 13.1Introduction 13.2A Simple Program: Printing a Line of Text in a Web Page 13.3Another JavaScript Program: Adding Integers 13.4Memory Concepts.
CMT Programming Software Applications
A simple C++ program /* * This program prints the phrase "Hello world!" * on the screen */ #include using namespace std; int main () { cout
 2003 Prentice Hall, Inc. All rights reserved. Customized by Sana Odeh for the use of this class. 1 Introduction to Computers and Programming in JAVA.
Variables, Data Types, & Arithmetic Expressions CSC 1401: Introduction to Programming with Java Lecture 3 Wanda M. Kunkle.
Java An introduction. Example 1 public class Example1 { public static void main (String [] args) { System.out.println (“This is the first example”); int.
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
Programming Introduction to C++.
1 Chapter One A First Program Using C#. 2 Objectives Learn about programming tasks Learn object-oriented programming concepts Learn about the C# programming.
A First Program Using C#
Introduction to C++ Programming Introduction to C++ l C is a programming language developed in the 1970's alongside the UNIX operating system. l C provides.
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.
IPC144 Introduction to Programming Using C Week 1 – Lesson 2
The Java Programming Language
Program A computer program (also software, or just a program) is a sequence of instructions written in a sequence to perform a specified task with a computer.
Intro and Review Welcome to Java. Introduction Java application programming Use tools from the JDK to compile and run programs. Videos at
CHAPTER 3 GC Java Fundamentals. 2 BASICS OF JAVA ENVIRONMENT  The environment  The language  Java applications programming Interface API  Various.
Introduction to C++ // Program description #include directives int main() { constant declarations variable declarations executable statements return.
 Pearson Education, Inc. All rights reserved Introduction to Java Applications.
Introduction to programming in the Java programming language.
Advanced Topics- Functions Introduction to MATLAB 7 Engineering 161.
 2000 Deitel & Associates, Inc. All rights reserved. Outline 8.1Introduction 8.2A Simple Program: Printing a Line of Text in a Web Page 8.3Another JavaScript.
A Simple Java Program //This program prints Welcome to Java! public class Welcome { public static void main(String[] args) { public static void main(String[]
Agenda Comments Identifiers Keywords Syntax and Symentics Indentation Variables Datatype Operator.
Variables in C Topics  Naming Variables  Declaring Variables  Using Variables  The Assignment Statement Reading  Sections
CMSC 104, Version 8/061L09VariablesInC.ppt Variables in C Topics Naming Variables Declaring Variables Using Variables The Assignment Statement Reading.
Department of Electronic & Electrical Engineering Statements Blocks{} Semicolons ; Variables Names keywords Scope.
C++ First Steps.
Chapter 6 JavaScript: Introduction to Scripting
Working with Java.
CSC201: Computer Programming
Introduction to the C Language
Chapter 3 GC 101 Java Fundamentals.
Yanal Alahmad Java Workshop Yanal Alahmad
Chapter 2, Part I Introduction to C Programming
Revision Lecture
C# and the .NET Framework
Data types and variables
Mr. Shaikh Amjad R. Asst. Prof in Dept. of Computer Sci. Mrs. K. S
An Object-Oriented Approach to Programming Logic and Design Fourth Edition Chapter 2 Applications and Data.
Lecturer: Mukhtar Mohamed Ali “Hakaale”
IPC144 Introduction to Programming Using C Week 1 – Lesson 2
Statements, Comments & Simple Arithmetic
2008/10/01: Lecture 8 CMSC 104, Section 0101 John Y. Park
CMSC 104, Section 4 Richard Chang
Variables In programming, we often need to have places to store data. These receptacles are called variables. They are called that because they can change.
Variables in C Topics Naming Variables Declaring Variables
Variables in C Topics Naming Variables Declaring Variables
Introduction to C++ Programming
Chapter 3 – Introduction to C# Programming
elementary programming
Anatomy of a Java Program
Chapter 2: Introduction to C++.
are shown in the COMMENTS example.
Programming Introduction to C++.
Classes CS 21a: Introduction to Computing I
Variables in C Topics Naming Variables Declaring Variables
2008/10/01: Lecture 8 CMSC 104, Section 0101 John Y. Park
Variables in C Topics Naming Variables Declaring Variables
Variables in C Topics Naming Variables Declaring Variables
JAVA. Java is a high-level programming language originally developed by Sun Microsystems and released in Java runs on a variety of platforms, such.
CS313T Advanced Programming language
Variables in C Topics Naming Variables Declaring Variables
PYTHON - VARIABLES AND OPERATORS
Presentation transcript:

Overview of c# Programming

Basit bir c# programı Belirleyiciler ve Anahtar kelimeleri Main- Programın başladığı nokta Boşluklar İfadeler Programdan text yazdırma yorumlar

I first need to show you what a C# program looks like and what its various parts mean. Let’s start by looking at a simple C# program. The complete program source is shown At next slide. As shown, the code is contained in a text file called SimpleProgram.cs. As you read through it, don’t worry about understanding all the details. I will give a line-by-line description of the code. When the code is compiled and executed, it displays the string “Hi there!” in a window on the screen. • One line contains two contiguous slash characters. These characters—and everything following them on the line—are ignored by the compiler. This is called a single-line comment.

More About SimpleProgram A C# program consists of one or more type declarations. The types in a program can be declared in any order. In the SimpleProgram example, only the class type is declared. A namespace is a set of type declarations associated with a name. SimpleProgram uses two namespaces. It creates a new namespace called Simple, and uses a predefined namespace called System.

More About SimpleProgram To compile the program, you can use Visual Studio or the command-line compiler. To use the command-line compiler, in its simplest form, use the following command: csc SimpleProgram.cs In this command, csc is the name of the command-line compiler and SimpleProgram.cs is the name of the source file.

Identifiers and Keywords Identifiers are character strings used to name things such as variables, methods, parameters, and a host of other programming constructs that will be covered later. You can create self-documenting identifiers by concatenating meaningful words into a single descriptive name, using uppercase and lowercase letters (e.g., CardDeck, PlayersHand, FirstName, SocSecurityNum). Certain characters are allowed or disallowed at certain positions in an identifier. • The alphabetic and underscore characters (a through z, A through Z, and _) are allowed at any position. • Digits are not allowed in the first position, but are allowed everywhere else. • The @ character is allowed in the first position of an identifier, but not anywhere else. The use of the @ character, although allowed, is discouraged for general use. These rules are illustrated as following

Identifiers are case sensitive Identifiers are case sensitive. For instance, the variable names myVar and MyVar are different identifiers. It is generally a bad idea, however, to have identifiers that differ only in the case of some of the letters. As an example, in the following code snippet, the variable declarations are all valid and declare different integer variables. But using such similar names will make coding more errorprone and debugging more difficult. Those debugging your code at some later time will not be pleased. // Valid syntactically, but don't do this! int totalCycleCount; int TotalCycleCount; int TotalcycleCount;

Naming Conventions The C# Language Specification suggests that certain casing conventions be used in creating identifiers. The suggested guidelines for casing are described and summarized in Table For most identifiers, the Pascal casing style should be used. In this style, each of the words combined to make an identifier is capitalized for example, FirstName and LastName.

Although these are the suggested guidelines, many organizations use other conventions—particularly in the naming of member fields, which will be introduced in following weeks text. Two of the common conventions are the following: • Begin a field name with an underscore: _HighTemp, _LowTemp. • Begin a field name with m_: m_HighTemp, m_LowTemp. Both of these methods have the advantage of showing you immediately that these identifiers are field names. These forms also allow Visual Studio’s IntelliSense feature to group all the fields together in the pop-ups.

Keywords Keywords are the character string tokens used to define the C# language. A complete list of the C# keywords is given in Table. Some important things to know about keywords are the following: • Keywords cannot be used as variable names or any other form of identifier, unless prefaced with the @ character. • All C# keywords consist entirely of lowercase letters. .NET type names, however, use Pascal casing.

Contextual keywords are identifiers that act as keywords only in certain language constructs. In those positions, they have particular meanings; but unlike keywords, which cannot ever be used as identifiers, contextual keywords can be used as identifiers in other parts of the code. The list of contextual keywords is shown in Table .

Main: The Starting Point of a Program Every C# program must have one class with a method (function) called Main. In the SimpleProgram program shown previously, it was declared in a class called Program. • The starting point of execution of every C# program is at the first instruction in Main. • The name Main must be capitalized. • The simplest form of Main is the following: static void Main( ) { Statements }

Whitespace Whitespace in a program refers to characters that do not have a visible output character. Whitespace in source code is ignored by the compiler, but is used by the programmer to make the code clearer and easier to read. Some of the whitespace characters include the following: • Space • Tab • New line • Carriage return For example, the following code fragments are treated exactly the same by the compiler in spite of their differences in appearance. // Nicely formatted Main() { Console.WriteLine("Hi, there!"); } // Just concatenated Main(){Console.WriteLine("Hi, there!");}