Your SlideShare is downloading. ×
.NET and C# introduction
.NET and C# introduction
.NET and C# introduction
.NET and C# introduction
.NET and C# introduction
.NET and C# introduction
.NET and C# introduction
.NET and C# introduction
.NET and C# introduction
.NET and C# introduction
.NET and C# introduction
.NET and C# introduction
.NET and C# introduction
.NET and C# introduction
.NET and C# introduction
.NET and C# introduction
.NET and C# introduction
.NET and C# introduction
.NET and C# introduction
.NET and C# introduction
.NET and C# introduction
.NET and C# introduction
.NET and C# introduction
.NET and C# introduction
.NET and C# introduction
.NET and C# introduction
.NET and C# introduction
.NET and C# introduction
.NET and C# introduction
.NET and C# introduction
.NET and C# introduction
.NET and C# introduction
.NET and C# introduction
.NET and C# introduction
.NET and C# introduction
.NET and C# introduction
.NET and C# introduction
.NET and C# introduction
.NET and C# introduction
.NET and C# introduction
.NET and C# introduction
.NET and C# introduction
.NET and C# introduction
.NET and C# introduction
.NET and C# introduction
.NET and C# introduction
.NET and C# introduction
.NET and C# introduction
.NET and C# introduction
.NET and C# introduction
.NET and C# introduction
.NET and C# introduction
.NET and C# introduction
.NET and C# introduction
.NET and C# introduction
.NET and C# introduction
.NET and C# introduction
.NET and C# introduction
.NET and C# introduction
.NET and C# introduction
.NET and C# introduction
.NET and C# introduction
Upcoming SlideShare
Loading in...5

Thanks for flagging this SlideShare!

Oops! An error has occurred.

Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

.NET and C# introduction


Published on

What is .NET? …

What is .NET?
What is C#?
Language Differences VB + C#
Review of OOP
N-Tier Solution Design
Creating WinForms applications

Published in: Education
  • Be the first to comment

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

No notes for slide
  • Click to add notesPeter Gfader Developing Windows and Web applications
  • implementing best of breed solutions that improve your operating efficiency and competitive advantage. We deliver scalable and extensible custom solutions on top of the latest Microsoft technologiesand one of three Microsoft Regional Directors in Australia
  • Java current version 1.6 Update 171.7 released next year 2010Dynamic languages Parallel computingMaybe closures
  • Make sure that seat allocation is ready for Adam and SumeshAlso inform them that the UTS environment needs some additional software installedAsk for USB devices so it can be copied for their installationPPT and Doc viewer + labs + PPT
  • Ask for people in the class who they are and backgroundPreferred nameShow booksShow training kits
  • This was the original description of .Net from around 2000 when it was announced.It is a consistent framework, tools, languages, runtime, and technologies that are structured in a coherent wayCompare to Java/ J2EE
  • 2002 v1.0 of .netfw
  • MSIL Independent from source languageFrom machine running onOpen notepadpublic class MyConsoleApp{ public static void Main() {System.Console.WriteLine("Hallo Welt"); }}Run csc filename.txtShow filesRun .exeIldasm .exe
  • The image is an old image from the early days of .Net :J# is depreciated and not used.J# was microsofts implementations of Java, and then Microsoft and Sun had a falling out
  • Examplepublic class SendHelloWorld{ public static void Main() {System.Console.WriteLine("Hallo Welt"); }}On command line „Csc helloworld.cs“ Run "helloworld.exe"
  • 22nd march
  • Principal design featuresInteroperability  Because interaction between new and older applications is commonly required, the .NET Framework provides means to access functionality that is implemented in programs that execute outside the .NET environment. Access to COM components is provided in the System.Runtime.InteropServices and System.EnterpriseServices namespaces of the framework; access to other functionality is provided using the P/Invoke feature. Common Runtime Engine  The Common Language Runtime (CLR) is the virtual machine component of the .NET framework. All .NET programs execute under the supervision of the CLR, guaranteeing certain properties and behaviors in the areas of memory management, security, and exception handling. Language Independence  The .NET Framework introduces a Common Type System, or CTS. The CTS specification defines all possible datatypes and programming constructs supported by the CLR and how they may or may not interact with each other. Because of this feature, the .NET Framework supports the exchange of instances of types between programs written in any of the .NET languages. This is discussed in more detail in Microsoft .NET Languages. Base Class Library  The Base Class Library (BCL), part of the Framework Class Library (FCL), is a library of functionality available to all languages using the .NET Framework. The BCL provides classes which encapsulate a number of common functions, including file reading and writing, graphic rendering, database interaction and XML document manipulation. Simplified Deployment  The .NET framework includes design features and tools that help manage the installation of computer software to ensure that it does not interfere with previously installed software, and that it conforms to security requirements. Security  The design is meant to address some of the vulnerabilities, such as buffer overflows, that have been exploited by malicious software. Additionally, .NET provides a common security model for all applications. Portability  The design of the .NET Framework allows it to theoretically be platform agnostic, and thus cross-platform compatible. That is, a program written to use the framework should run without change on any type of system for which the framework is implemented. Microsoft's commercial implementations of the framework cover Windows, Windows CE, and the Xbox 360.[4] In addition, Microsoft submits the specifications for the Common Language Infrastructure (which includes the core class libraries, Common Type System, and the Common Intermediate Language),[5][6][7] the C# language,[8] and the C++/CLI language[9] to both ECMA and the ISO, making them available as open standards. This makes it possible for third parties to create compatible implementations of the framework and its languages on other platforms.
  • Consolidated many different technologies and concepts under one consistant framework and platformRegular expressions (Regex)Cryptography
  • “in theory at least” – poor coding and lack of understanding can lead to bad software still!
  • Story about Anders:Delphi was better than vb,So microsoft bought anders, but his contract wouldn’t allow him to work straight away, so they paid him to sit on a beach for a platform is the next quantum leap from delphiIt effectively killed borlandbuilt with the hindsight of many languages, but most notably Java and C++. It was co-authored by Anders Hejlsberg (who is famous for the design of the Delphi language), and Scott Wiltamuth.
  • Transcript

    • 1. Developing Windows and Web Applications using Visual Studio.NET
      Peter Gfader
    • 2. Agenda
      About SSWand Presenters
      Student Introduction
      Course Overview
      .NET Overview
      VS. Net Overview/ Demo
      Design Patterns
      Hands on lab
    • 3. SSW Consulting has 18 years development / consulting experience.
      Adam Cogan is the Chief Software Architect at SSW
      1of 3 Microsoft Regional Directors in Australia
      About SSW
    • 4. SSA @ SSW
      Loves C# and .NET (Java not anymore)
      Specializes in
      Windows Forms
      TFS testing
      Automated tests
      Peter Gfader
    • 5. Attendance
      Please initial the sheet next to your name
      Hands On Lab
      Please get Peter to initial sheet
      At end of 10 sessions
      Admin Stuff
    • 6. Name
      C# / VB
      Goals for the course
      Anything else after 9PM
    • 7.
      Part 1: .NET WinForms
      Overview of .NET & C# basics
      C# Advanced + Data in Forms
      Usability - Rules to Better Windows Forms
      Deployment and Security of Windows Forms
      Web Services and Threading
      The 10 Sessions
    • 8.
      Part 2: .NET Webforms
      Overview of ASP.NET Webforms
      Data in Webforms
      Rich Web Forms and
      Other ASP.NET Features
      Web Security
      Advanced Topics & Future Technology
      The 10 Sessions
    • 9. What is .NET?
      What is C#?
      Language Differences VB + C#
      Review of OOP
      N-Tier Solution Design
      Demo: Creating WinForms
      Session 1: Overview
    • 10. .NET is the Microsoft Web services strategy to connect information, people, systems, and devices through software
      Microsoft, beginning 2000
      What is .NET?
    • 11. What is .NET?
      An application development platform from Microsoft
      Runtime (Virtual machine)
      Languages, IDE, …
      Rapidly develop secure and robust software
      Web and Windows
      Full support for object-oriented programming
    • 12. Compiles to MSIL
      Represents codeindependent from src
      Executes MSIL
    • 13. What is .NET?
      Language Independence
      Any language that supports the Common Language Runtime (CLR) Specification
    • 14. CLR
      = Virtual machine
    • 15. Tools
    • 16. 2002 - .Net 1.0 / Visual Studio.NET
      2003 - .Net 1.1 / Visual Studio 2003
      2005 - .Net 2.0 / Visual Studio 2005
      2007 - .Net 3.5 / Visual Studio 2008
      2008 - .Net 3.5sp1 (added EDMX)
      2010 - .Net 4.0/ VS.Net 2010
      Details on
      History of .NET and Visual Studio
    • 17. Interoperability
      Common Runtime Engine (CLR)
      Language Independence
      Base Class Library
      Simplified Deployment
      Principal Design Features
    • 18. Over 4500 classes that provides features such as:
      Data access and connectivity (ADO.NET)
      User Interfaces (WinForms, WPF)
      Web Applications (ASP.NET, Silverlight)
      Network Communication (WCF)
      Workflow (WF)
      What is the .NET Framework?
    • 19. Evolution
      The whole .NET FX 3.5
      Only new types in .NET 4
      .NET Framework
    • 20. Allows for language independence
      Memory Management (allocation and de-allocation of memory)
      Performs automatic garbage collection with the elimination of pointers
      No more memory leaks (in theory at least!)
      Exception Handling
      Security (sandbox from the OS– cannot run malicious code)
      Converts the IL byte code into runtime code
      CLR =Common Language Runtime
    • 21. Main programming language for .NET framework
      Based on C
      Object Oriented
      Built with hindsight
      Java Very similar to Java
      C++ Very similar to C++
      A ‘modern language’ that did not inherit the ‘junk’ from C++ (eg header files, syntax)
      C# ?
    • 22. Variable declaration
      bool isVeryLong;
      Variable assignment
      isVeryLong = false;
      Control statements
      if (yourInput.Length > 10)
      isVeryLong = true;
      C# Basis
    • 23. C# 1.0 – First Version
      C# 2.0 – Everything that didn’t fit in 1.0
      C# 3.0 – LINQ, functional influence
      C# 4.0 – Dynamic Programming
      C# 5.0 …
      History C# - Anders Hejlsberg
    • 24. Base Class Library
      Highly structured via Namespaces:
      See VS.NET/.NET Framework help for complete breakdown
    • 25. OOP
    • 26. Terms - I want you to know
      #1 Inheritance
      #2 Encapsulation
      #3 Polymorphism
      #4 Abstraction
    • Class vs. Object
      • Class
      Defines abstract characterizations of a “thing”
      Blueprint or template
      Instance of a class
      “Car” has an instance called “petersCar”
    • 31. Properties
      Changeable features of objects
      Eg. „Color“ of a car
      Actions on an object
      Eg. Car has a method „Accelerate“
      Let other objects know about an action
      Eg. Car has an event „DoorOpened“
    • 32. #1 Inheritance
    • 33. A "square" is a "shape"
      #1 Inheritance
    • 34. A "shape" defines a common property "Color"
      A "square" inherits the property "Color"
    • 35. Information hiding
      E.g.A shape hides internal data
      1st point
      2nd point
      #2 Encapsulation
    • 36. A „Square" has internal fields like „_side“
    • 37. Appear as another
      Be used like another
      #3 Polymorphism
    • 38. var shapes = new List<IShapes>() {
      new Square(“Red"),
      new Rectangle(“Blue"),
      new Triangle(“Red")
      foreach (var shape in shapes) {
      Console.WriteLine(shape.Color + ": " + shape.CalcSize());
      #3 Polymorphism
    • 39. Allows inheritance but no instantiation
      #4 Abstraction
    • 40. No instance of a "Shape"
    • 41. Common Type System
      Reference Types
      All derive from System.Object
      Referential Identity
      Every object created is DISTINCT from any other object created
      Eg two “People” may have the same name, but will always be two individuals
    • Boxing is converting a Value Type into a corresponding Reference Type.
      Unboxing is converting the Reference Type into a Value Type
      intfoo = 42; // Value type.
      object bar = foo; // foo is boxed to bar.
      int foo2 = (int)bar; // Unboxed back to value type.
      Boxing and Unboxing
    • 51. VB.NET versus C#
    • 52. Variables
      Language Differences
      ' VB
      DimFavouriteColourAsString = "LightGreen"
      // C#
      StringFavouriteColour = "LightGreen";
    • 53. Methods
      Language Differences
      Public Function GetName () As String
      Public Sub DoSomething()
      public string GetName() {}
      public void DoSomething() {}
    • 54. Events and Methods
      Language Differences
    • 55. VB Properties
      Language Differences
      PublicPropertyFirstName() AsString
      Set(ByVal value AsString)
      pFirstName = value
    • 56. C# Properties
      Language Differences
      private string firstName;
      public StringFirstName{ get { returnfirstName } set { firstName= value; } }
    • 57. Automatic Properties Feature
      public StringFirstName{ get; set;}
      Notice no internal variable was declared?
       It is created by the compiler
      Saves typing and makes code neater
      Properties since C# 3.0
    • 58. Auto Implemented Properties
      Collection Initializers
      Named parameters
      Optional parameters
      Can span statements across multiple lines
      Auto Implemented Properties
      Collection Initializers (limited)
      Named parameters
      Optional parameters
      Lambdas (limited)
      Can span statements across multiple lines
      .NET 3.5
    • 59. Auto Implemented Properties
      Collection Initializers
      Named parameters
      Optional parameters
      Can span statements across multiple lines
      Auto Implemented Properties
      Collection Initializers
      Named parameters
      Optional parameters
      Can span statements across multiple lines
      .NET 4
    • 60. Visual Studio 2010
    • 61. Visual Studio 2010
    • 62. Windows Forms
    • 63. A UI Component
      WinForm – a Window displayed by an application
      Web Forms are page hosted in a browser
      What is a Form?
    • 64. Textboxes
      Tool Strip Menu
    • 65.
      • Reuse a set of controls
      e.g. Form with
      Billing Address and
      Shipping Address
      Where an address consists of
      Address line 1
      Address line 2
      Post code
      User Controls
    • 66. Most controls have events
      Event Handlers
      Can’t control the order the event gets handled
    • 67. "Programming"
      Able to code in that language
      "Understanding .NET“
      Understanding the .NET Framework and technology
      Knowing when and what do and why
      Architecture vs. Programming
    • 68. Namespace
      Dot syntax. E.g. System.Collections
      Useful Terms…
      • Unit Test
      • 69. Reference (e.g. Component Reference)
      • 70. Embedded Resource
      • 71. Project vs. Solution
    • Compiled binaries that can be understood by the CLR
      Known in .NET as “Assembly”
      Assembly contain classes, structures, components, UI components, execution logic
      Suffixed with extension .dll and named according to Namespace
      Eg: SSW.Framework.Utilities.dll
      What is a Library
    • 72. A design pattern is a general repeatable solution to a commonly occurring problem in software design.
      Referred to as GoF (Gang of Four, after their authors).
      Considered the foundation for all other software patterns.
      This concepts are incorporated in the .Net Framework (eg. The Iterator pattern)
      Design Patterns
    • 73. Gang of Four Patterns
      Creational Patterns
      Abstract Factory
      Creates an instance of several families of classes
      Separates object construction from its representation
      Factory Method
      Creates an instance of several derived classes
      A fully initialized instance to be copied or cloned
      A class of which only a single instance can exist
    • 74. Gang of Four Patterns
      Behavioral Patterns
      Chain of Resp.
      A way of passing a request between a chain of objects
      Encapsulate a command request as an object
      A way to include language elements in a program
      Sequentially access the elements of a collection
      Defines simplified communication between classes
      Capture and restore an object's internal state
      A way of notifying change to a number of classes
      Alter an object's behaviour when its state changes
      Encapsulates an algorithm inside a class
      Template Method
      Defer the exact steps of an algorithm to a subclass
      Defines a new operation to a class without change
    • 75. Gang of Four Patterns
      Structural Patterns
      Match interfaces of different classes
      Separates an object’s interface from its implementation
      A tree structure of simple and composite objects
      Add responsibilities to objects dynamically
      A single class that represents an entire subsystem
      A fine-grained instance used for efficient sharing
      An object representing another object
    • 76. Enterprise Architecture Patterns
      Design Patterns representing an entire system/software application
      Logical layers
      Areas of concern
      Gang of Four Patterns
    • 77. N-Tier Application Simplified
    • 78. Separate logic and data access from presentation
      Easier to maintain code
      Modularity/Re-use business logic
      Easily add a different UI
      Web UI
      Smart Phone UI
      Team Development
      Why n-tier?
    • 79. Keep the users in mind
    • 80. Keep the users in mind
    • 81. WPF?
    • 82. Windows Presentation Foundation
      Rich Windows Applications
      Great Architecture + Great Graphics
      Rapid Prototyping
      2D, 3D, Vector, Document Flow, Layouts, Composition, etc.
      WPF in a nutshell
    • 83. User interface (UI) components. User interface components provide a way for users to interact with the application. They render and format data for display to users, and acquire and validate data that users enter.
      User process components. To help synchronize and orchestrate these user interactions, it can be useful to drive the process using separate user process components. This avoids hard-coding the process flow and state-management logic in the UI elements themselves, and the same basic user interaction patterns can be reused by multiple UIs.
      Business components. Business components implement the business logic of the application. Regardless of whether a business process consists of a single step or an orchestrated workflow, your application will probably require components that implement business rules and perform business tasks.
      Rich Client App Architecture
    • 84. Business workflows. After the required data is collected by a user process, the data can be used to perform a business process. Many business processes involve multiple steps that must be performed in the correct order and orchestrated. Business workflows define and coordinate long-running, multi-step business processes, and they can be implemented using business process management tools.
      Business entity components. Business entities are used to pass data between components. The data represents real-world business entities, such as products or orders. The business entities that are used internally in the application are usually data structures, such as DataSets, DataReaders, or Extensible Markup Language (XML) streams, but they can be implemented as custom object-oriented classes that represent the real-world entities your application has to work with, such as a product or an order.
      Rich Client App Architecture
    • 85. Application façade (optional). A façade is used to combine multiple business operations into single message-based operation. You might access the application façade from the presentation layer by using a range of communication technologies.
      Data access logic components. Data access components abstract the logic necessary to access your underlying data stores. Doing so centralizes data access functionality and makes it easier to configure and maintain.
      Data Helpers/utilities. Implement data helpers for centralizing generic data access functionality such as managing database connections and caching data. You can design data source–specific helper components to abstract the complexity of accessing the database. Avoid adding any business logic to the helper components.
      Service agents. When a business component must use functionality provided in an external service, you might need to provide some code to manage the semantics of communicating with that particular service. Service agents isolate the idiosyncrasies of calling diverse services from your application, and can provide additional services such as basic mapping between the format of the data exposed by the service and the format your application requires.
      Rich Client App Architecture
    • 86. The 10 Sessions
      Overview of .NET
      Language Differences
      n-Tier Application Architecture
      Demo: Creating WinForms (C#)
    • 87. Creating a Windows Form Application
      Opening forms
      Event handlers
      User controls
      Hands ON LAB
    • 88. The C# tutorial
      Online videos and training
      Nice video to OOP
      More on OOP
      Resources 1/2
    • 89. Design patterns in C#
      Winforms tips and tricks
      Use controls in Windows Forms!
      Beginner Developer Learning Center
      Resources 2/2
    • 90. 3things…
    • 91. Thank You!
      Gateway Court Suite 10 81 - 91 Military Road Neutral Bay, Sydney NSW 2089 AUSTRALIA
      ABN: 21 069 371 900
      Phone: + 61 2 9953 3000 Fax: + 61 2 9953 3105