Download presentation
Presentation is loading. Please wait.
Published byHubert Shepherd Modified over 9 years ago
1
Getting Started with C# August 29, 2005
2
.NET Concepts Language Independence Language Integration your C# program can use a class written in VB Program are compiled into "assemblies" of "microsoft intermediate language" code When a program is run, the IL is compiled into machine code by the Just-In-Time compiler
3
Some Features of C# Completely Object-Oriented even main() must be part of a class Syntax is very similar to C++ for loops and comments are the same IO is different Garbage collection is automatic Strongly Typed Variables must be initialized before their use
4
Hello World - 1.0 class Class1 { static void Main() { System.Console.WriteLine("Hello World"); }
5
Hello World - 1.1 #region Compiler Directives using System; #endregion namespace Test2 { class MainProgram { static void Main() { DateTime today = DateTime.Now; // sample variable Console.Write("Hello, "); Console.WriteLine("Today is {0}/{1}/{2}", today.Month, today.Day, today.Year); }
6
Hello World - 1.1 #region Compiler Directives using System; #endregion namespace Test2 { class MainProgram { static void Main() { DateTime today = DateTime.Now; // sample variable Console.Write("Hello, "); Console.WriteLine("Today is {0}/{1}/{2}", today.Month, today.Day, today.Year); } Allows the editor to compress this code into a single line Just in case another class is named MainProgram the Month property of the today instance Just like C++ Print the value of a variable Declaration and Initialization less typing required, but System.Console is not legal
7
Using MS Visual Studio 1.Open MS Visual Studio.NET via the Start menu 2.Open a new project 1. select both "C#" and "Console Application" 2. rename the project to something such as "lab01" 3. hit "OK" 3.Get rid of all the junk the editor added for you string[] args etc… 4.Enter your source code 5.To compile: Build -> Build Solution 6.To run: Debug -> Start without Debugging
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.