Visula C# Programming Lecture 1
Upcoming SlideShare
Loading in...5
×
 

Visula C# Programming Lecture 1

on

  • 523 views

Lecter 1

Lecter 1

Statistics

Views

Total Views
523
Views on SlideShare
523
Embed Views
0

Actions

Likes
0
Downloads
17
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • ECMA is a standards body – for example Jscript – or “ECMAScript” <br />
  • As an aside…the CLR itself is a COM application – can be hosted (along with any .NET Code) by anything that can host COM. <br /> CLR does an assembly load, checks with the policy manager, and if granted, loads the class, which will then do JIT…and it’s an iterative process <br /> The CLR is going to be providing the GC, Exception Handling, Class Initialization, Security, etc. <br /> JIT can still be done at Install Time to noticeably start up faster. <br /> -GC can run on the same thread or concurrently – also does memory defrag, also handles finding memory to delete <br />
  • Dave starts talking about GAC <br /> …config files can be set up to force an exe to use a certain version other than that’s in the assembly. <br />
  • Dave transitions to Barry <br />

Visula C# Programming Lecture 1 Visula C# Programming Lecture 1 Presentation Transcript

  • Visual Programming C# 1
  • SUN MICROSOFT 2
  • Microsoft and Sun's Confrontation        It's new it's powerful it solves lots of problems it is threatening to a vast community of Java worshippers, and best (or worst) of all it's from Microsoft. You guessed it right;I am talking about .NET Around 1995, Java was generating the same Strength as is generated by .NET today !. Sun's Java introduced a revolutionary approach of software development Java provided the programmer's with a unique tool that solved their ages long problem of platform independence 3
  • Microsoft and Sun's Confrontation    Sun addressed industry's needs by coming up with tools like JSP, Servlets, EJB, JMS, JNDI, JNI etc. Sun stuffed these excellent tools under one umbrella - the Java2 Enterprise Edition (J2EE). Microsoft was trying to catch up All this time when Sun was winning our admiration; Microsoft was trying their level best to match up to Sun's tools. But Sun was un-catchable Microsoft answer was Microsoft's Windows DNA (Distributed interNet Applications Architecture ) programming model 4
  • Microsoft and Sun's Confrontation   With the world depending more and more on the Internet - and Sun's tools becoming the foremost media for the web applications So Microsoft put their best men at work and started calling the project as Next Generation Windows Services (NGWS). 5
  • What is .NET?   Microsoft defines .NET as “a set of Microsoft software technologies for connecting information, people, systems, and devices“ However, Microsoft .NET is not just another programming language  It’s   a complete new business initiative Mission statement: Access to Information anywhere, anytime Everything evolves around the Internet 6
  • The .NET Framework objectives of The .NET Framework       To provide a consistent object-oriented programming environment whether object code is stored and executed locally, executed locally but Internet-distributed, or executed remotely. To provide a code-execution environment that minimizes software deployment and versioning conflicts. To provide a code-execution environment that guarantees safe execution of code, including code created by an unknown or semi-trusted third party. To provide a code-execution environment that eliminates the performance problems of scripted or interpreted environments. To make the developer experience consistent across widely varying types of applications, such as Windows-based applications and Web-based applications. To build all communication on industry standards to ensure that code based on the .NET Framework can integrate with 7 any other code.
  • Information Anywhere, Anytime ■ Server machines that provide information or services (database server, content provider,…) 8
  • Information Anywhere, Anytime ■ Sophisticated computing devices that communicate with PCs to allow access to information 9
  • Information Anywhere, Anytime ■ A standardized protocol for the internet to allow different programs and devices to talk to each other 10
  • Information Anywhere, Anytime ■ A set of developer tools that allows you to write server and client programs as well as XML Web Services 11
  • Personal Opinion New programming languages new virtual machine simply a great IDE 12
  • Conventional Developing Source Code Source Code Binary code In the past, compiled code only runs on the computer it was compiled for Binary code Operating System Operating System 13
  • Virtual Machine Concept Source Code Intermediate code Intermediate code Virtual Machine Virtual Machine Operating System Operating System Virtual Machine acting as the adaptor to the physical computer Compiled code will run on any computer as long as this virtual machine is installed 14
  • .NET Framework Microsoft Intermediate Language (MSIL) .NET Framework / Common Language Runtime (CLR) Operating System Virtual Machine is called “Common Language Runtime” (CLR) or sometimes simply .NET Framework Compiled code also called “Microsoft Intermediate Language” (MSIL) 15
  • .NET Framework C# VB.NET MSIL J# Many .NET languages C#, VB.NET J# C++ .NET Cobol, Perl ... 16
  • .Net Languages     Unlike Java’s VM, different languages can be used to compile into Intermediate Language. C# - more like Java than C++ VB.NET – Visual Basic’s response J#, Cobol, Fortran, Scheme, Perl, ... 17
  • Installing the .NET Framework    .NET Framework installs only on Windows 98 and above It’s a 20 MB file named “dotnetfx.exe” Can also be found  http://windowsupdate.microsoft.com  Comes pre-installed starting with Windows Server 2003 18
  • .NET Framework Class Library  There are literally thousands of extremely useful classes that cover very common tasks:  File operations, networking, cryptography  Database access, Windows-related tasks  One major key to .NET programming is actually to know the classes (instead of wasting time writing them from scratch) 19
  • Namespaces  Every class belongs to a namespace  e.x., FileInfo belongs to the System.IO namespace  You can refer to it using System.IO.FileInfo or use the “using” or “imports” keyword to “import” entire namespaces  This allows different classes with the same name to co-exist 20
  • What is "Common Type System" (CTS)      provide language interoperability language sharing the same data types int should mean the same in VB, VC++, C# and all other CTS, much like Java, defines every data type as a Class Every .NET compliant language must stick to this definition 21
  • Popular Project Types        Console applications. Scripted or hosted applications. Windows GUI applications (Windows Forms). ASP.NET applications. XML Web services. Windows services. Windows Forms Application   ASP.NET Applications   .NET programs that run under the Microsoft Windows platform (previously known as “Win32 Applications”) An entire website that is driven by Microsoft .NET Smart Clients  Sophisticated computing devices that communicate with PCs to allow access to information  PDAs, Laptops, Terminals, Cellphones 22
  • .NET Development VB C++ C# J# … Common Language Specification ASP.NET Web Forms Web Services Mobile Internet Toolkit Windows Forms ADO.NET and XML Base Class Library Common Language Runtime Operating System 23
  • The .NET Framework: Common Language Specification  Basic themes of .NET is unification and interoperability between various programming languages  To achieve this there must be some rules followed by all the languages  CLS is the collection of the rules and constraints that every language (that seeks to achieve .NET compatibility) must follow 24
  • The .NET Framework: Common Language Specification   Microsoft have defined three level of CLS compatibility/compliance. COMPLIANT PRODUCER   CONSUMER   The language in this category can use classes produced in any other language EXTENDER   The component developed in this type of language can be used by any other language Languages in this category can not just use the classes as in CONSUMER category; but can also extend classes using inheritance Microsoft is providing   Visual Basic®, C++, C#, J#, JScript® Industry and academia  APL, COBOL, Eiffel, Fortran, Haskell, ML, Perl, Python, RPG, Scheme, Smalltalk, … 25
  • Common Language Infrastructure The following organizations have participated and their contributions are gratefully acknowledged: Fujitsu Software, Hewlett-Packard, Intel Corporation, International Business Machines, ISE, Microsoft Corporation, Monash University, Netscape, OpenWave, Plum Hall, Sun Microsystems 26
  • .NET Development VB C++ C# J# … Common Language Specification ASP.NET Web Forms Web Services Mobile Internet Toolkit Windows Forms ADO.NET and XML Base Class Library Common Language Runtime Operating System 27
  • Common Language Runtime: Execution model Source code C# C++ Compiler Managed code VB Compiler Compiler Assembly IL Code Assembly IL Code Assembly IL Code Unmanaged Component Common Language Runtime JIT Compiler Native Code Operating System Services 28
  • What is "Microsoft Intermediate Language" (MSIL)     A .NET programming language (C#, VB.NET, J# etc.) does not compile into executable code compiles into an intermediate code called Microsoft Intermediate Language (MSIL). The MSIL code is then send to the CLR (Common Language Runtime) that converts the code to machine language which is then run on the host machine MSIL is similar to Java Byte code 29
  • Common Language Runtime      Every .NET Framework application relies on the CLR Every .NET Framework assembly contains a manifest:  Class/Method Meta-Data  Versioning Information The common language runtime manages memory, thread execution, code execution, code safety verification, compilation, and other system services The runtime is designed to enhance performance The runtime also accelerates developer productivity 30
  • Inside a .NET Framework Application   During Execution, MSIL is JIT Compiled Method-by-Method, and stored in the Global Assembly Cache (machine-wide code cache ) on the Hard Drive The GAC knows the version information!  Copy a new version, execute – and both versions are still available in the cache. App1.exe Ref: Widget.dll, ver 1.2.1.7 App2.exe Ref: Widget.dll, ver 1.3.0.0 Widget.dll Ver 1.2.1.7 GAC Widget.dll Ver 1.3.0.0 31
  • .NET Development VB C++ C# J# … Common Language Specification ASP.NET Web Forms Web Services Mobile Internet Toolkit Windows Forms ADO.NET and XML Base Class Library Common Language Runtime Operating System 32
  • Start Visual Studio.Net 2005 Click on New Project Button 33
  • . Starting Projects   Creating a New Project In the Visual Studio.NET environment, select File | New | Project from the menu. 34
  • • • • • • • In left window, select “Visual Basic Projects”. In right window, select “Console Application” Name it What u want (Note: No Spaces!) Click “Browse” button to select your Location. Note location where project will be saved. Click “OK” button to create the project. 35
  • using System; using System.Collections.Generic; using System.Text; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { Console.WriteLine ("This is first Program"); Console.ReadLine(); } } } 36
  • Console Output Note the console window. 37 Press enter to exit that window.