.NET Tech Talk Series - PowerPoint PPT Presentation

1 / 23
About This Presentation
Title:

.NET Tech Talk Series

Description:

Third in a series of .NET Technical Talks sponsored by ... unchecked unsafe ushort using virtual void while. C .NET primer (cont.) Assembly. Source Code ... – PowerPoint PPT presentation

Number of Views:79
Avg rating:3.0/5.0
Slides: 24
Provided by: michae430
Category:
Tags: net | series | talk | tech | unchecked

less

Transcript and Presenter's Notes

Title: .NET Tech Talk Series


1
.NET Tech Talk Series
Intro to C
  • Wednesday, February 5th, 2003
  • Michael Dunn ( mdunn_at_cs.drexel.edu )
  • Drexel University Student Ambassador to Microsoft
  • Mid-Atlantic Student Ambassador Team Lead
  • MCS Society Vice President

2
Agenda
  • Introduction
  • What is C?
  • A first look at C
  • Code demo
  • C features
  • Conclusion
  • Questions
  • Raffle

3
Introduction
  • Third in a series of .NET Technical Talks
    sponsored by Microsoft and Drexels Math and
    Computer Science Society.
  • Summary of last talk
  • Keep your old C code, and inter-operate with
    .NET using C.NET to get access to the class
    library, security, and garbage collection.
  • As usual
  • Please remember to fill out evaluations you
    cant win a door prize without a completed form
  • Please hold detailed questions till the end

4
What is C?
  • A new object oriented language
  • Syntax based on C
  • Similar to C and Java
  • Used to write .NET software
  • Software that targets the .NET Framework is
    called managed code
  • C gains much from the .NET Framework
  • Internet oriented platform
  • JIT compilation
  • Automatic memory management
  • Security, type-safety
  • Framework Class Library

5
What is C?
  • Existing languages are powerful. Why do we need
    another language?
  • Important features are spread out over multiple
    languages
  • choose between pointers (C)
  • or garbage collection (Java)
  • Old languages new features poor syntax
  • Garbage collection in C?
  • Event-driven GUIs in Java?

6
What is C?
  • Derived from the features and syntaxes of other
    languages
  • The safety of Java
  • The ease of Visual Basic
  • The power of C

7
What is C?
  • The safety of Java
  • 100 object oriented
  • Automatic garbage collection
  • Array bounds checking at runtime
  • Strict type checking
  • Structured exception handling

8
What is C?
  • The ease of Visual Basic
  • First class support for properties
  • First class support for events
  • For-each loops

9
What is C?
  • The power of C
  • Enumerations
  • Operator overloading
  • Mathematical, Indexing, and Casting
  • Function pointers
  • Called delegates
  • Type safe
  • Structs
  • Option to pass parameters by reference of by
    value
  • Can disable type-safety, garbage collection, and
    bounds checking
  • Can directly manipulate memory with pointers

10
A first look at C
  • using System.Windows.Forms
  • using System.Drawing
  • class MyFormForm
  • public static void Main()
  • Application.Run(new MyForm())
  • protected override void OnPaint(PaintEventArgs
    e)
  • e.Graphics.DrawString("Hello World!",
  • new Font("Arial", 35), Brushes.Blue, 10, 100)

11
Code demo
12
What is C?
  • Most users think of two types of objects
  • Real objects Customer, Order, etc.
  • Primitive types int, float, bool
  • Different expectations for each
  • Real objects are more expensive to create
  • Primitives always have a value
  • Primitives have operator support

13
What is C?
  • Traditional views
  • C, Java Primitive types are magic and do not
    interoperate with objects
  • C offers improved extensibility and reusability
  • New primitive types Decimal, SQL,
  • Collections, etc., work for all types

14
What is C?
  • Unified type system
  • All types ultimately inherit from object
  • Classes, enums, arrays, delegates, structs,
  • An implicit conversion exists from any type to
    type object

15
What is C?
  • 76 keywords
  • abstract as base bool break byte case
  • catch char checked class const continue decimal
  • default delegate do double else enum event
  • explicit extern false finally fixed float for
  • foreach goto If implicit in int interface
  • internal is lock long namespace new null
  • object operator out override params private protec
    ted
  • public readonly ref return sbyte sealed short
  • sizeof stackalloc static string struct switch
  • this throw true try typeof uint ulong
  • unchecked unsafe ushort using virtual void while

16
C.NET primer (cont.)
Compilation
Code (IL)
Source Code
Metadata
JIT Compiler
Native Code
Execution
17
C.NET primer
  • C.NET is _not_ a dramatically different
    language from your daddys C
  • Everett C.NET will be 98 compliant with the
    ISO standard
  • Everett will ship with /GS compiler flag to
    catch buffer overflows
  • The syntax generally remains the same, while the
    compiler emits entirely different instructions
  • Due to Intermediate Language (IL), machine
    instructions are generated at runtime

18
C.NET primer
  • Why use C.NET over C, or other .NET languages
  • Use managed or unmanaged code
  • Keep using your low-level or performance critical
    native code alongside .NET
  • Lots of code already written in C
  • /clr compiler switch IJW (It Just Works)
  • Use cross-language debugging and all the other
    neat .NET tricks

19
C.NET demo
  • Live demo of C.NET with
  • Visual Studio.NET 2002

20
Conclusions
  • C.NET targets the same lower-level developers
    as Visual C 6.
  • Compile your old C code using the C.NET
    compiler to get the advantages of .NET.
  • Moving toward ISO standardization

21
Next tech talk
  • Next week, Wednesday!
  • Same time, same place
  • Topic Intro to C
  • More books, software and food

22
Further references
  • http//www.gotdotnet.com/team/cplusplus/
  • http//msdn.microsoft.com/visualc/
  • http//www.cplusplus.com/

23
Questions / Raffle
  • Send your evaluations forward!
Write a Comment
User Comments (0)
About PowerShow.com