lecture11 C#

lecture11 C# - Com S 319 C# Language Quick Overview...

Info iconThis preview shows pages 1–14. Sign up to view the full content.

View Full Document Right Arrow Icon
Com S 319 C# Language Quick Overview Yih-Cheng (Bruce) Lee [email protected]
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Before we begin You all know Java language. The syntax of C# is very similar to Java. You can  read C# code very easily. When you see C#  syntax, please think about corresponding Java  syntax in your mind. Syntax is very similar but coding style for GUI is  different. People used to call Windows Forms for .Net  application on windows desktop and Web Forms  for .Net application on web. This introduction to C# just covers C# 1.0  fundamental knowledge.
Background image of page 2
Outline 1. Overview of C# 2. Using Value Type Variables 3. Statements and Exceptions 4. Methods and Parameters 5. OOP related syntax
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
4 1. Overview of C# 1-1. Structure of a C# Program 1-2. Basic Input/Output Operations 1-3. Recommended Practices 1-4. Compiling, Running, and Debugging
Background image of page 4
5 1-1. Structure of a C# Program Hello, World The Class The Main Method The using Directive and the  System Namespace
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
6 Hello, World  (A console  program) using System; class Hello { public static void Main() { Console.WriteLine("Hello, World"); } } // what is Console ?
Background image of page 6
7 The Class A C# application is a collection of classes,  structures, and types A class is a set of data and behaviours Syntax A C# application can consist of many files A class CAN span multiple files (PARTIAL) class name { ... }
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
8 The Main Method When writing Main, you should: Use an uppercase “M”, as in “Main” Designate one  Main  as the entry point to the  program Declare  Main  as  public static void Main When Main finishes, or returns, the  application quits
Background image of page 8
The using Directive and the System  Namespace The .NET Framework provides many utility  classes Organized into namespaces System is the most commonly used  namespace Refer to classes by their namespace The using directive System.Console.WriteLine("Hello, World"); using System; Console.WriteLine("Hello, World");
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
10 1-2. Basic Input/Output  Operations The Console Class Write and WriteLine Methods Read and ReadLine Methods
Background image of page 10
11 The Console Class Provides access to the standard input,  standard output, and standard error  streams Only meaningful for console applications Standard input – keyboard Standard output – screen Standard error – screen
Background image of page 11

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
12 Write and WriteLine Methods Console.Write and Console.WriteLine  display information on the console screen WriteLine  outputs a line feed/carriage return Both methods are overloaded A format string and parameters can be  used Text formatting Numeric formatting
Background image of page 12
13 Read and ReadLine Methods Console.Read and Console.ReadLine  read user input Read  reads the next character ReadLine  reads the entire input line
Background image of page 13

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 14
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 03/27/2008 for the course COMS 319 taught by Professor Jiang during the Spring '08 term at Iowa State.

Page1 / 99

lecture11 C# - Com S 319 C# Language Quick Overview...

This preview shows document pages 1 - 14. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online