1 / 11

Distributed Systems

Distributed Systems. Tutorial 1 - Getting Started with Visual C# .NET. Course Info. Home page: http://webcourse.cs.technion.ac.il/236351 Three Mandatory Programming Assignments Requirements: Working knowledge of Java / C# Basic knowledge of OOP concepts

comacho
Download Presentation

Distributed Systems

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Distributed Systems Tutorial 1 - Getting Started with Visual C# .NET

  2. Course Info • Home page: http://webcourse.cs.technion.ac.il/236351 • Three Mandatory Programming Assignments • Requirements: • Working knowledge of Java / C# • Basic knowledge of OOP concepts • Basic knowledge of network concepts (sockets, protocols) • No textbook, look at the home page for manuals, tutorials and additional resources

  3. Hello World application • Development in Visual Studio is organized around solutions, which contain one or more projects. For this tutorial, we will create a solution with a single C# project. • Creating a New Project • In the Visual Studio .NET environment, select File | New | Project from the menu.

  4. Hello World application cont. • Select Visual C# Projects on the left and then Console Application on the right. .

  5. Specify the name of your project and enter the location in which to create the project. The project directory will be created automatically by Visual Studio • Click OK and you're on your way!

  6. Class1.cs • using System; • namespace HelloWorld • { • class Class1 • { • static void Main(string[] args) • { • Console.WriteLine("Hello C# World!"); • } • } • }

  7. Namespaces • Namespaces are used to define scope in C# applications • Multiple source code files can contribute to the same namespace • The using directive permits you to reference classes in the namespace without using a fully qualified name • class Class1 • { • static void Main(string[] args) { • System.Console.WriteLine ("Hello, C#.NET World!"); } • }

  8. Namespaces cont. • using System; • class Class1 • { • static void Main(string[] args) { • Console.WriteLine ("Hello, C#.NET World!"); } • } • When the compiler parses theConsole.WriteLine method, it will determine that the method is undefined. • It will search through the namespaces specified with the using directives and will find the method in the System namespace and will compile the code.

  9. Namespaces cont. • Note that using directive applies to namespaces and not to classes • In the example: • System is the namespace • Console is the class • WriteLine is a static method belonging to Console • Therefore the following code would be invalid:

  10. using System.Console; // ERROR: Can’t use a using directive with a class • class Class1 • { • static void Main(string[] args) { • WriteLine ("Hello, C#.NET World!"); } • } • But its possible: • using output = System.Console; //alias • output.WriteLine(“Hello, C#.NET World”);

  11. Skeleton • using <namesplace> • namespace <your optional namespace> • class <your class> • { • public static void Main() • { • // TODO: Add code to start application here } • } • Notice that the angle brackets denote where you need to supply information.

More Related