Intro to c
This presentation is the property of its rightful owner.
Sponsored Links
1 / 21

Intro to C# PowerPoint PPT Presentation


  • 92 Views
  • Uploaded on
  • Presentation posted in: General

Intro to C#. Dr. John P. Abraham UTPA. Background required. Thorough C++ programming If you made an A in 1370/1170 you will do fine with some effort. If you have already taken 2380, you will find this course not very difficult.

Download Presentation

Intro to C#

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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Intro to c

Intro to C#

Dr. John P. Abraham

UTPA


Background required

Background required

  • Thorough C++ programming

    • If you made an A in 1370/1170 you will do fine with some effort.

    • If you have already taken 2380, you will find this course not very difficult.

  • You need to be able to look up how to get things done (example, look up syntax)


Programming programming programming

Programming, programming, Programming

  • This class is unlike other courses in that you will spend a lot of time doing actual programming.

  • You should never copy a program from someone else. Even if your program does not perform as good as someone else’s, you should submit what you have.

  • You should not hesitate to ask questions in class.


Assignments

Assignments

  • Unless I announce it, programs are due in one week after assignment is given in class, or posted. Sometimes, I will ask you to modify a program for the next class period. Occasionally, I will give two weeks for difficult programs.

  • You should work on a program the same day it is assigned. That way you can ask questions during the following class period.


Use of the textbook

Use of the textbook

  • I will not be covering chapter by chapter.

  • I will cover important points needed to complete the assignments.

  • You need to search the index in the back to find the topic needed for each assignment.

  • You can also obtain help from MSDN at the Microsoft site.


Hello program

Hello program

using System;

//using System.Collections.Generic;

//using System.Linq;

//using System.Text;

namespace sayHello

{

class sayHello

{

static void Main(string[] args)

{

Console.WriteLine("Hello!");

Console.WriteLine("Welcome to Dr. Abraham's C# Class!");

Console.ReadLine();

}

}

}


Versions of c

Versions of C#

  • You can program using 2008 or 2010.

  • Our book only covers 2008. Usually it takes a year or so for new books to come out. If you use 2010, you have to find help from other sources or the Web.


The net framework

The .Net framework

  • Underneath the applications you develop using c# is the .NET Framework containing a library of classes needed for windows forms and web forms.

  • The .NET framework interacts with the Common Language Runtime (CLR), which in turn interacts with the operating system and the hardware.

  • This way programs you write using C# can run on different operating systems and hardware platforms as long as it has the correct version of the .NET installed on it.


Common language runtime

Common Language Runtime

  • The Microsoft Common Language Runtime (CLR) and the .NET Framework class libraries – collectively called the .NET Framework.

  • CLR is Microsoft's implementation of the Common Language Infrastructure (CLI) standard, which defines an execution environment for program code. In the CLR, code is expressed in a form of bytecode called the Common Intermediate Language (CIL, previously known as MSIL—Microsoft Intermediate Language).

  • All programming languages within the visual studio compile into an intermediate language (CIL).

  • At runtime, the CLR's just-in-time compiler converts the CIL code into code, native to the operating system.

  • Alternatively, the CIL code can be compiled to native code in a separate step prior to runtime by using the Native Image Generator (NGEN). This speeds up all later runs of the software as the CIL-to-native compilation is no longer necessary.


Net is built on the following internet standards

.NET is built on the following Internet Standards

  • HTTP, the communication protocol between Internet Applications

  • XML, the format for exchanging data between Internet Applications

  • SOAP, the standard format for requesting Web Services

  • UDDI, the standard to search and discover Web Services


Web services

Web Services

  • Web Services provide data and services to other applications. Web services use the standard web protocols HTTP, XML, SOAP, WSDL, and UDDI.

  • Future applications will access Web Services via standard Web Formats (HTTP, HTML, XML, and SOAP), with no need to know how the Web Service itself is implemented.

  • Web Services are main building blocks in the Microsoft .NET programming model.


Web services building blocks

Web services building blocks

  • XML (eXtensible Markup Language) is a well known standard for storing, carrying, and exchanging data.

  • SOAP (Simple Object Access Protocol) is a lightweight platform and language neutral communication protocol that allows programs to communicate via standard Internet HTTP.

  • WSDL (Web Services Description Language) is an XML-based language used to define web services and to describe how to access them.

  • UDDI (Universal Description, Discovery and Integration) is a directory service where businesses can register and search for web services. UDDI is a public registry, where one can publish and inquire about web services.


Namespaces

Namespaces

  • Within the .NET Framework, related classes are grouped into Namespaces.

  • You need to insert a “using AppropriateNamespace” in your program. After that you can refer to methods and attributes of classes contained therein.


To get net namespace documentation

To get .Net namespace documentation

  • Visit

    Msdn.microsoft.com/en-us/library/ms229335.aspx


How do you write and run a program

How do you write and run a program?

  • Use visual studio to create a project. The project file will have the extension csproj. The project stores all related files, including the source file you write. Every project has a solution file with the extension sln. You would be opening this file when you want to return to your program you were writing. This will open all associated files. The associated files may be contained in a subdirectory.

  • After writing the source code, go to build and build your solution, which creates the intermediate code.

  • Go to debug and start without debugging. The program run will finish and give you a prompt to press any key to continue. Start with debugging, it will complete the run and return to you to the IDE. If your IDE does offer “without debugging”, add a console.readkey() statement.


Using the form designer

Using the Form designer

  • You can size the form by holding the handles in the corners or the middle.

  • Controls and other items are added to the form using the toolbox. If control or item has properties that can be set.

  • To write the code for an event, you can click on the view code button above the solution explorer or by simply clicking on a button or anything else on the form.

  • Files with code you write will have extension .cs. Files ending with designer.cs are code files generated by visual studio.


Options for a new project

Options for a new project

  • Go to tools and choose options

  • You may want to change the default project locations

  • Look the Project properties, go to project and choose properties. If you have multiple forms, you can choose which one you want to start with.

  • If you want enter button to be accepted instead of clicking a mouse, go to the properties of the form and choose acceptButton.


Naming controls and boxes

Naming Controls and Boxes

  • Use a convention you will remember.

  • I start all button names with btn. For example an accept button will be named btnAccept. An exit button will be named btnExit.

  • All text boxes will start with txt. For example, sales amount will be named txtSalesAmount.

  • All labels with start with lbl. For example, lblEnterName.

  • It is up to you to choose naming conventions you will recognize.


Your first assignment

Your First Assignment

  • Assignment #1

  • The purpose of this assignment is to practice reading and writing to console using C#. It is a simple assignment. Use the following program run to design and write your program. Please submit Program listing and a screen capture of the program run. Follow the textbook examples to add comments as documentation.


Intro to c

  • Make sure to include your name, assignment number, date due and date completed on each assignment you submit. Assignment should be submitted in a manila folder with your name and assignment number appearing on the tab.


Time for class

Time for class

I expect to hold the class for little over an hour each time. Remaining time should be spend with your assigned groups to discuss the project in class. Please do not exchange programs with each other, just ideas.


  • Login