1 / 34

.NET and Visual Studio

.NET and Visual Studio. IS 135 Business Programming. .NET Framework. The most recent MS announcement An attempt to enter the “enterprise” arena Good programmer tools Excellent access to universal resources Will allow many languages Large Base Library for all languages. .NET Continued.

elisha
Download Presentation

.NET and Visual Studio

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. .NET and Visual Studio IS 135 Business Programming

  2. .NET Framework • The most recent MS announcement • An attempt to enter the “enterprise” arena • Good programmer tools • Excellent access to universal resources • Will allow many languages • Large Base Library for all languages

  3. .NET Continued • Only on Windows at the moment • However, the Intermediate Language (IL) that results from compilation is possibly machine independent • This portable executable (PE) is part of the familiar .EXE file

  4. .NET Continued • The idea is to create programs in .NET • Compile them in the “common language runtime” (CLR)… more later • The code is translated into native code • Any language that is compliant will run

  5. .NET Continued • MS used existing concepts and improved on them to create .NET • It has: robust CLR • Extensive class library • Internet based inter process communication • Multiple languages

  6. .NET Framework Web Forms WIN forms Web Services Data Access XML Classes Base Classes .NET Framework Operating System

  7. Class Library • Saves you writing common routines • Contains over 2500 classes • Classes contain commonly used routines like printing, display etc • Available to all languages under .NET through CLR

  8. .Net and C# Structure

  9. Start Page

  10. Programming Environment

  11. Execution Screen

  12. CLR- Simplify App Dev • 2500 classes, programmer can reuse • Organizations can create their own reusable code • Memory management simple with auto garbage collection

  13. CLR - Performance • High level languages always worse than assembler • JIT compiles method into native code first • Next time it executes directly in native code • Allocation of memory is next available storage • Deallocation done by garbage collector

  14. Why CLR? • Without it, compiler has to create safety • But there are many compilers, some 3rd party • All languages do not have safety features • Some compiler implementations are slow

  15. CLR Design • Interpreter or compiler • Interpreter does work at runtime, slow • Modern systems, have front-end compiler, back-end runtime

  16. CLR – Intermediate Language • Front end does all checking, creates IL • JIT can create reusable native code • Better runtime performance

  17. CLR and JVM • Java Virtual Machine widely used • Very similar to CLR • Most important differences: • CLR supports many languages • Java implemented on many platforms

  18. Types • Other OOs call them a class • Abstraction of data and behavior together • Fields, methods, properties, events

  19. Common Type System • Provides wide range of modern operations • Shared by CLR, compilers, tools • Framework for cross-language operation • Integer 16 on some machines, 32 on others • Limited code reuse between languages • Each language has some types • CTS establishes rules for cross-language calls

  20. Managed Data, Garbage Collect • CLR reserves a contiguous block for initialized data – Managed Heap • Fast allocation from it • Older languages had to search for available space • CLR performs deallocation as part of garbage collection • When memory is low, frees up unreferenced memory

  21. Getting started … • From Program select Visual Studio .NET • Be sure to select NEW PROJECT • Then Visual C# Project and • From the right hand window choose CONSOLE APPLICATION • In the bottom window change the NAME to your assignment number

  22. OUR style Rules After USING statement, there are /// (comments) Keep // but replace line 1 with YOUR NAME After // in line 2 replace text with the assignment # After // in line 3 replace text with DUE date Always insert a comment after } Ex: } // end namespace Now look at the example…

  23. Helpful Hints • No semicolons when: • Next character is a { • The current character is a } • The line of text is over 1 line long • For the next few weeks, every program will have a Main() method.

  24. Example • Please watch carefully… • First we will enter VS, C# • Then we will modify the skeleton program • We will try to make it run • First compile (check syntax etc) Build solution • Correct errors • Run program Debug, Start w/o debugging • Check results • Print results (next slide)

  25. How to print program, results From Visual studio, print program Run the program (Debug/Start) With the output (black) screen visible: press print screen on top of keyboard on top left of black screen right click icon press select all again press copy Start WORD, paste copied material there

  26. Assignment 0Due Date: NEXT CLASS • Write a program to display 3 lines of text. • Line 1 your name • Line 2 your grad year • Line 3 your major Display instruction in C#: Console.WriteLine(“XXX”); (where XXX is the text to be displayed)

  27. How to get started • Turn off the monitor • get paper and pen • What results are expected? • What data are you given? • Is that enough to produce output? • In English, list variables if needed • List steps needed to display results ex: display my name • Write C# instructions • Turn on Monitor, enter program

  28. Assignment 0aDue Date: Next Class • Write a program to allow user input for name, reason for taking course, and your major.

  29. Develop logic • Turn off the monitor • get paper and pen • What output is expected? • What data are you given? • Is that enough to produce output? • In English, list variables if needed • List steps needed to meet user request ex: allow user input for name display my name … • Write C# instructions • Turn on Monitor, enter program

  30. More on Input/Output Console.Readline(); Console.Write (or WriteLine); Example: string Name; // declare variable Name=Console.ReadLine(); Console.WriteLine(“My name is ” + Name); or Console.WriteLine(“My name is {0}”, Name);

  31. string name; string street; string city; Console.Write(“Please enter your Name ”); name = Console.ReadLine(); Console.Write(“Please enter your Street ”); street = Console.ReadLine(); What would go here? city = Console.ReadLine(); Console.WriteLine(“my bio {0} {1}, {2}”, name, street, city); Output: my bio smith 123 street, ffld More on Input/Output

  32. Program Style • We listed some // comments earlier • We also should have 4 sections in every program //declare section (where you assign variables etc) //input section (accept user input) //computations (where you do calculations) //display results • IN THAT ORDER

  33. using System; namespace WTprog1 { // wt // program 1 // due date: 1/31/05 class Class1 { static void Main(string[] args) { // declare section // input section // computation section // display section {// end Main {//end class {// end namespace

More Related